Untitled
unknown
python
a year ago
1.1 kB
5
Indexable
img_info_depth = [] vid = cv2.VideoWriter('projection.mp4', fourcc, 10.0, (width, height)) for (boxes, class_names, image_path), velo_path in \ zip(return_predictions(images_paths, model), velo_paths): velo_points = load_from_bin(velo_path) ans, c_, depth = velo3d_2_camera2d_points(velo_points, v_fov=(-24.9, 2.0), h_fov=(-45,45), \ vc_path=v2c_filepath, cc_path=c2c_filepath, mode=mode) frame = cv2.imread(image_path) annotator = Annotator(frame) avg_depths = np.array([]) for box in boxes: xyxy = box.xyxy[0].cpu().numpy() # # top left # xmin = xyxy[0] # ymin = xyxy[1] # # bottom right # xmin = xyxy[2] # ymin = xyxy[3] avg_depth = get_avg_depth(xyxy, ans, depth) avg_depths = np.append(avg_depths, avg_depth) avg_depth_int = int(avg_depth) if not np.isnan(avg_depth) else 0 # {model.names[int(box.cls)]} annotator_text = f'est_depth={int(avg_depth_int)}' annotator.box_label(box.xyxy[0], annotator_text) frame = annotator.result() cv2_imshow(frame) vid.write(img) vid.release()
Editor is loading...
Leave a Comment