def get_distance_var(lof,width,height,frame_oi): filtered_frames=[] print('') print('Now in get_distance_var') print(lof) for f in lof: print('loop') print(f) frames=get_green_frames(f,width,height) print(type(frames)) filtered_frames.append(filter2_test_j(frames[frame_oi,:,:])) print "Getting all the distances.." # Get all the distances using all videos as ref point, thus size of matrix is n^2 list_of_ref = [] for frame_ref in filtered_frames: list_of_positions = [] res_trials = parmap.map(image_registration.chi2_shift, filtered_frames, frame_ref) # res_trials is array of trials * [dx, dy, edx, edy] for res in res_trials: list_of_positions.append(Position(res[0], res[1])) #for frame in filtered_frames: # dx, dy, edx, edy = image_registration.chi2_shift(frame_ref, frame) # list_of_positions.append(Position(dx, dy)) list_of_ref.append(list_of_positions) print "Finding the min..." list_of_positions = find_min_ref(list_of_ref) return list_of_positions
def get_green_video_frames(lof,width,height): print('') print('in get_green_video_frames') print(lof) list_of_trial_frames = [] lof_tmp=[] lof_tmp.append(lof) print(type(lof_tmp)) for video_file in lof_tmp: print ("Getting green frames: " + str(video_file)) frames = get_green_frames(video_file,width,height) frames = frames[:800, :, :] print np.shape(frames) list_of_trial_frames.append(frames) print np.shape(list_of_trial_frames) return list_of_trial_frames