Incorrect image-plane bounds for off-center cameras in visualize_model.py
维护者通常 1 天内回复
@wuyuze713 已经在做这个了。
开始于 2026年10月13日。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 80/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- numpy, python
调研方向
从 python/examples/visualize_model.py 中的 draw_camera() 开始,这里根据主点和反投影的角点计算图像平面的宽度和高度。使用 issue 中的复现脚本,以 cx=100 的 640x480 相机运行,它应该在平面最大边界处的 assert_allclose 上失败。当主点偏离中心时,平面的 x/y 边界与四个视锥角点一致,并且无头回归检查通过,即为完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
draw_camera() in python/examples/visualize_model.py draws an image plane that does not meet the frustum corners when the principal point is horizontally off-center. For a 640x480 PINHOLE camera with fx=fy=500 and (cx, cy)=(100, 240), the plane spans x=[-0.2, 0.2], but the frustum spans x=[-0.2, 1.08].
To reproduce
From the repository root, with NumPy, Open3D and pycolmap installed:
PYTHONPATH=python/examples python - <<'PY'
import numpy as np
from visualize_model import draw_camera
K = np.array([[500., 0., 100.], [0., 500., 240.], [0., 0., 1.]])
_, plane, frustum = draw_camera(K, np.eye(3), np.zeros(3), 640, 480)
corners = np.asarray(frustum.points)[1:]
print("plane:", plane.get_min_bound(), plane.get_max_bound())
print("frustum:", corners.min(axis=0), corners.max(axis=0))
np.testing.assert_allclose(plane.get_max_bound()[:2], corners[:, :2].max(axis=0))
PY
This assertion fails on main. No visualization window, dataset or GPU is needed.
Expected behavior / proposed fix
The plane's x/y bounds should coincide with the four back-projected image corners. Its width currently sums the magnitudes of two left-edge coordinates, so it depends on cx instead of image width. Compute width and height from signed differences between opposing corners; this also avoids the absolute-value height error when using an off-image principal point directly with this helper. A two-line fix and headless regression coverage are prepared.
Environment
- macOS 15.1.1, arm64, CPU; Python 3.12.3
- COLMAP main
9e32193dbd451d59c26769fe499167ab4c4748aa; pycolmap 4.2.1 wheel - NumPy 2.5.4, Open3D 0.20.0
- Synthetic intrinsics; no capture device
- 主要语言
- C++
- 星标
- 12.9k
- 派生
- 2.2k
- 平均合并
- 1 天 2 小时
- 30 天内合并 PR
- 80
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
colmap/colmap 的其他 Issue
-
Linking error未关闭
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
NVIDIA-Omniverse/PhysX#590 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
apache/rocketmq-clients#1469 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 9 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
compiler-explorer/compiler-explorer#9402 ·
维护者通常 1 天内回复
-
自定义颜色添加为常用颜色未关闭
难度 2/5 1-3 小时 新手友好度 62/100
mg-chao/snow-apps#2227 · 2 条评论 ·
维护者通常 1 天内回复