elif args.get("video", None) is None: argcam= args["folder"] # otherwise, we are reading from a video file else: argcam= args["video"] if args["tra_file"] is None: if args["folder"] is None: raise NameError('target trajectory file is not present') else: folder_path = os.path.dirname(args["folder"]) args["tra_file"] = os.path.join(folder_path, 'trajectory.tra') display=False bbee = BlobFinder(mask, None) bbee.erode_iter = 2 bbee.dilate_iter = 3 bbee.threshold = 128 bbee.gaussian_blur = 3 bbee.skip_filter_contours = True #Parameters markers: max_area = 40 params = [80,300] gaussian_blur=5 # Create image for display scale = 0.4 refresh_time = 0.5 nframe_bg = 1000 camera = cv2.VideoCapture(argcam)
scale = 0.4 refresh_time = 0.5 blob_brightness = [20, 30, 150, 254] max_nb_images = 1 # Bfinder parameters args = dict() # loop over the frames of the video t_start = time.time() # mask background = btgen.background() mask = btgen.mask(background) # Create a bfinder tracker bfinder = BlobFinder(mask) bfinder.erode_iter = 2 bfinder.dilate_iter = 2 bfinder.area_lim = [0, 10000] bfinder.roundness_lim = [0, 1] bfinder.background_init = 60 bfinder.threshold = 10 bfinder.gaussian_blur = 1 bfinder.skip_filter_contours = False # Parameter for croping xmargin = [0, 0] ymargin = [0, 0] # Build up an expected histogram ninitframes = 50 bin_edges = np.arange(1, 255) ref_cumsum = np.zeros(bin_edges.shape[0] - 1) for _ in range(bfinder.background_init):
elif args.get("video", None) is None: argcam = args["folder"] # otherwise, we are reading from a video file else: argcam = args["video"] if args["tra_file"] is None: if args["folder"] is None: raise NameError('target trajectory file is not present') else: folder_path = os.path.dirname(args["folder"]) args["tra_file"] = os.path.join(folder_path, 'trajectory_v2.tra') bmarker = BlobFinder(mask, None) bmarker.erode_iter = 1 bmarker.dilate_iter = 1 bmarker.area_lim = [0, 2000] bmarker.roundness_lim = [0, 1] bmarker.threshold = args["threshold"] bmarker.gaussian_blur = 1 bmarker.skip_filter_contours = True # Create image for display scale = 0.4 refresh_time = 0.5 nframe_bg = 100 camera = cv2.VideoCapture(argcam) background = get_background(camera, nframe_bg) background = background[..., 0] camera.release()