define_boolean_argument(parser, *var2opt('disparity'), 'capture disparity instead of left/right streams', False) define_boolean_argument( parser, *var2opt('wls_disparity'), 'capture wls disparity instead of left/right or normal disparity streams', True) define_boolean_argument(parser, *var2opt('show_wls_preview'), 'show host-side WLS filtering made with OpenCV', False) args = parser.parse_args() if args.prefix is None: print(f'Please specify a valid prefix for video files. Exiting...') sys.exit(0) wlsFilter = wlsFilter(args, _lambda=8000, _sigma=1.5) baseline = 75 #mm disp_levels = 96 fov = 71.86 depth_cap = cv2.VideoCapture(f'depth-{args.prefix}.h265') depth_len = int(depth_cap.get(cv2.CAP_PROP_FRAME_COUNT)) rright_cap = cv2.VideoCapture(f'rectright-{args.prefix}.h265') rright_len = int(rright_cap.get(cv2.CAP_PROP_FRAME_COUNT)) print(f'{rright_len = } - {depth_len = }') #small_size = (1280, 720) small_size = (640, 400)
# Closer-in minimum depth, disparity range is doubled: depth.setExtendedDisparity(False) # Better accuracy for longer distance, fractional disparity 32-levels: depth.setSubpixel(False) ''' left.out.link(depth.left) right.out.link(depth.right) baseline = 75 #mm disp_levels = 96 fov = 71.86 wlsFilter = wlsFilter(args, _lambda=8000, _sigma=1.5, baseline=baseline, fov=fov, disp_levels=disp_levels) wls_queue = multiprocessing.Queue() wls_data = [ ] # filtered_disp, colored_disp = pool.map(apply_wls_filter, (disp_imgs, rr_imgs)) wls_results = [] wls_counter = 0 def wls_worker(queue, wlsFilter): print(f'Thread {os.getpid()} starting...') while True: print(f'Thread {os.getpid()} dequeuing...')