diff --git a/image_fusion/Image_Registration_test.py b/image_fusion/Image_Registration_test.py index bf5731c..8aa975a 100644 --- a/image_fusion/Image_Registration_test.py +++ b/image_fusion/Image_Registration_test.py @@ -201,6 +201,47 @@ def main(matchimg_vi, matchimg_in): return 0, None, 0 +def parse_args(): + # 输入可见光和红外图像路径 + visible_image_path = "../test/visible.jpg" # 可见光图片路径 + infrared_image_path = "../test/infrared.jpg" # 红外图片路径 + # 输入可见光和红外视频路径 + visible_video_path = "../test/visible.mp4" # 可见光视频路径 + infrared_video_path = "../test/infrared.mp4" # 红外视频路径 + + """解析命令行参数""" + parser = argparse.ArgumentParser(description='图像融合与目标检测') + + parser.add_argument('--mode', type=str, choices=['video', 'image'], default='image', + help='输入模式:video(视频流) 或 image(静态图片)') + + # 区分摄像头或视频文件 + parser.add_argument('--source', type=str, choices=['camera', 'file'], + help='视频输入类型:camera(摄像头)或 file(视频文件)') + + # 视频模式参数 + parser.add_argument('--video1', type=str, default=visible_video_path, + help='可见光视频路径(仅在source=file时需要)') + parser.add_argument('--video2', type=str, default=infrared_video_path, + help='红外视频路径(仅在source=file时需要)') + + # 摄像头模式参数 + parser.add_argument('--camera_id1', type=int, default=0, + help='可见光摄像头ID(仅在source=camera时需要,默认0)') + parser.add_argument('--camera_id2', type=int, default=1, + help='红外摄像头ID(仅在source=camera时需要,默认1)') + parser.add_argument('--output', type=str, default='output.mp4', + help='输出视频路径(仅在video模式需要)') + + # 图片模式参数 + parser.add_argument('--visible', type=str, default=visible_image_path, + help='可见光图片路径(仅在image模式需要)') + parser.add_argument('--infrared', type=str, default=infrared_image_path, + help='红外图片路径(仅在image模式需要)') + + return parser.parse_args() + + if __name__ == '__main__': time_all = 0 dots = 0