Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Incorrect image-plane bounds for off-center cameras in visualize_model.py

未关闭 适合新手
#4,855 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@wuyuze713 已经在做这个了。

开始于 2026年10月13日。

  • #4856 来自 @wuyuze713 —— 未关闭
  • #4868 来自 @Nikhila-Dhevi-R —— 已关闭,未合并

评估

难度
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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

colmap/colmap 的其他 Issue

查看 colmap/colmap 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。