diff --git a/config/prototype_of3.json b/config/prototype_of3.json index e1d8c06..04571e9 100644 --- a/config/prototype_of3.json +++ b/config/prototype_of3.json @@ -18,7 +18,7 @@ "nominal_ov_pos": 100, "n": [3,3], "row_tol": 0.6, - "box_size": [250, 250] + "box_size": [220, 220] }, "tracker": { "adaptive": true, diff --git a/promote_video.py b/promote_video.py index 4f1a98b..bbbf127 100644 --- a/promote_video.py +++ b/promote_video.py @@ -147,21 +147,23 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument("--video","-v", type=str, default="s1.mp4", help="视频文件路径") - parser.add_argument("--fps", type=float, default=30) + parser.add_argument("--fps", type=float, default=15) args = parser.parse_args() fps_video = args.fps arrow_writer = cv2.VideoWriter(args.video.replace(".mp4", "_arrows.mp4"), cv2.VideoWriter_fourcc(*'mp4v'), fps_video, (384, 384)) pyqt_writer = cv2.VideoWriter(args.video.replace(".mp4", "_pyqt.mp4"), cv2.VideoWriter_fourcc(*'mp4v'), fps_video, (1600, 1200)) depth_writer = cv2.VideoWriter(args.video.replace(".mp4", "_depth.mp4"), cv2.VideoWriter_fourcc(*'mp4v'),fps_video, (384, 384)) - sensor1 = orisys.Sensor(args.video, config_name="./config/prototype_of3.json", cal_path= "./config/dd01a_98.npy", isstitch=True, cuda=False, verbose=True) + sensor1 = orisys.Sensor(args.video, config_name="./config/prototype_of3.json", cal_path= args.video.replace(".mp4", ".npy"), isstitch=True, cuda=True, verbose=True) start_time = time.time() is_save = False frame_count = 0 writer = None while True: - sensor1.get_img() # 提取并拼接复眼图像 + img = sensor1.get_img() # 提取并拼接复眼图像 + if img is None: + break; sensor1.compute_deformation() # 计算形变和分解 sensor1.compute_contact() @@ -177,7 +179,7 @@ def main(): # 显示向量场 # Background color #24292E (BGR) black_img = np.full_like(sensor1.img, bg_color) - arrows = orisys.util.draw_arrows(black_img, flow, threshold=1, grid_spacing=20, arrow_scale=0.5, colormap=cv2.COLORMAP_PARULA, below_threshold_color=text_color) + arrows = orisys.util.draw_arrows(img, flow, threshold=1, grid_spacing=20, arrow_scale=0.5, colormap=cv2.COLORMAP_PARULA, below_threshold_color=text_color) cv2.imshow("Deformation", arrows) # 显示深度图