# video_camera_calibration_moge_mapper Compute the camera intrinsics and field of view (FOV) for a static camera using Moge-2 (more accurate than DeepCalib). 使用 Moge-2(比 DeepCalib 更精确)计算静态相机的内参和视场角(FOV)。 Type 算子类型: **mapper** Tags 标签: gpu, video ## 🔧 Parameter Configuration 参数配置 | name 参数名 | type 类型 | default 默认值 | desc 说明 | |--------|------|--------|------| | `model_path` | | `'Ruicheng/moge-2-vitl'` | The path to the Moge-2 model. | | `frame_num` | typing.Annotated[int, Gt(gt=0)] | `3` | The number of frames to be extracted uniformly from the video. If it's 1, only the middle frame will be extracted. If it's 2, only the first and the last frames will be extracted. If it's larger than 2, in addition to the first and the last frames, other frames will be extracted uniformly within the video duration. If "duration" > 0, frame_num is the number of frames per segment. | | `duration` | | `0` | The duration of each segment in seconds. If 0, frames are extracted from the entire video. If duration > 0, the video is segmented into multiple segments based on duration, and frames are extracted from each segment. | | `tag_field_name` | | `'camera_calibration_moge_tags'` | The field name to store the tags. It's "camera_calibration_moge_tags" in default. | | `frame_dir` | | `DATA_JUICER_ASSETS_CACHE` | Output directory to save extracted frames. | | `if_output_info` | | `True` | Whether to save the camera parameters results to an JSON file. | | `output_info_dir` | | `DATA_JUICER_ASSETS_CACHE` | Output directory for saving camera parameters. | | `if_output_points_info` | | `True` | Determines whether to output point map in OpenCV camera coordinate system (x right, y down, z forward). For MoGe-2, the point map is in metric scale. | | `if_output_depth_info` | | `True` | Determines whether to output depth maps. | | `if_output_mask_info` | | `True` | Determines whether to output a binary mask for valid pixels. | | `args` | | `''` | extra args | | `kwargs` | | `''` | extra args | ## 📊 Effect demonstration 效果演示 ### test ```python VideoCameraCalibrationMogeMapper(model_path='Ruicheng/moge-2-vitl', frame_num=1, duration=1, frame_dir=DATA_JUICER_ASSETS_CACHE, if_output_info=True, output_info_dir=DATA_JUICER_ASSETS_CACHE, if_output_points_info=True, if_output_depth_info=True, if_output_mask_info=True) ``` #### 📥 input data 输入数据
Sample 1: 1 video
video3.mp4:
Sample 2: 1 video
video4.mp4:
Sample 3: 1 video
video12.mp4:
#### 📤 output data 输出数据
Sample 1: empty
frame_names_shape
[49]
intrinsics_list_shape
[49, 3, 3]
hfov_list_shape
[49]
vfov_list_shape
[49]
points_list_shape
[49, 640, 362, 3]
depth_list_shape
[49, 640, 362]
mask_list_shape
[49, 640, 362]
Sample 2: empty
frame_names_shape
[22]
intrinsics_list_shape
[22, 3, 3]
hfov_list_shape
[22]
vfov_list_shape
[22]
points_list_shape
[22, 360, 480, 3]
depth_list_shape
[22, 360, 480]
mask_list_shape
[22, 360, 480]
Sample 3: empty
frame_names_shape
[3]
intrinsics_list_shape
[3, 3, 3]
hfov_list_shape
[3]
vfov_list_shape
[3]
points_list_shape
[3, 1080, 1920, 3]
depth_list_shape
[3, 1080, 1920]
mask_list_shape
[3, 1080, 1920]
### test_mul_proc ```python VideoCameraCalibrationMogeMapper(model_path='Ruicheng/moge-2-vitl', frame_num=1, duration=1, frame_dir=DATA_JUICER_ASSETS_CACHE, if_output_info=True, output_info_dir=DATA_JUICER_ASSETS_CACHE, if_output_points_info=True, if_output_depth_info=True, if_output_mask_info=True) ``` #### 📥 input data 输入数据
Sample 1: 1 video
video3.mp4:
Sample 2: 1 video
video4.mp4:
Sample 3: 1 video
video12.mp4:
#### 📤 output data 输出数据
Sample 1: empty
frame_names_shape
[49]
intrinsics_list_shape
[49, 3, 3]
hfov_list_shape
[49]
vfov_list_shape
[49]
points_list_shape
[49, 640, 362, 3]
depth_list_shape
[49, 640, 362]
mask_list_shape
[49, 640, 362]
Sample 2: empty
frame_names_shape
[22]
intrinsics_list_shape
[22, 3, 3]
hfov_list_shape
[22]
vfov_list_shape
[22]
points_list_shape
[22, 360, 480, 3]
depth_list_shape
[22, 360, 480]
mask_list_shape
[22, 360, 480]
Sample 3: empty
frame_names_shape
[3]
intrinsics_list_shape
[3, 3, 3]
hfov_list_shape
[3]
vfov_list_shape
[3]
points_list_shape
[3, 1080, 1920, 3]
depth_list_shape
[3, 1080, 1920]
mask_list_shape
[3, 1080, 1920]
## 🔗 related links 相关链接 - [source code 源代码](../../../data_juicer/ops/mapper/video_camera_calibration_moge_mapper.py) - [unit test 单元测试](../../../tests/ops/mapper/test_video_camera_calibration_moge_mapper.py) - [Return operator list 返回算子列表](../../Operators.md)