admin管理员组文章数量:1334704
I want to draw 3D Positions in a webcam Image using OpenCV's projectPoints function. During testing I noticed, that I always have a certain offset from the real object. This is most obvious when trying to project the origin (0,0,0) to the image center. The image shape is (2988, 5312, 3), the big red dot is the image center at (1494, 2656) and the small red dot with the lines attached is the projection of the origin (0,0,0) with NO translation and NO rotation leading to (1476, 2732).
The main question: Why is the projected point not in the middle of the image?
I determined the projected point like so:
origin_2d, jacobian = cv2.projectPoints(
np.array([(0.0, 0.0, 0.0)]),
np.array([(0.0, 0.0, 0.0)]),
np.array([(0.0, 0.0, 0.0)]),
mtx,
dist,
)
So the origin (0,0,0) should be projected to 2D with no translation and no rotation and thus appear in the image center, right?
I obtained the camera mtx and dist by executing a camera calibration routine as described here OpenCV docs:Camera Calibration using the chessboard you see in the image. Is there something wrong with my calibration? Or am I misunderstanding something in the projection process?
Thanks and best regards, Felix
I want to draw 3D Positions in a webcam Image using OpenCV's projectPoints function. During testing I noticed, that I always have a certain offset from the real object. This is most obvious when trying to project the origin (0,0,0) to the image center. The image shape is (2988, 5312, 3), the big red dot is the image center at (1494, 2656) and the small red dot with the lines attached is the projection of the origin (0,0,0) with NO translation and NO rotation leading to (1476, 2732).
The main question: Why is the projected point not in the middle of the image?
I determined the projected point like so:
origin_2d, jacobian = cv2.projectPoints(
np.array([(0.0, 0.0, 0.0)]),
np.array([(0.0, 0.0, 0.0)]),
np.array([(0.0, 0.0, 0.0)]),
mtx,
dist,
)
So the origin (0,0,0) should be projected to 2D with no translation and no rotation and thus appear in the image center, right?
I obtained the camera mtx and dist by executing a camera calibration routine as described here OpenCV docs:Camera Calibration using the chessboard you see in the image. Is there something wrong with my calibration? Or am I misunderstanding something in the projection process?
Thanks and best regards, Felix
Share Improve this question edited Nov 20, 2024 at 12:49 Christoph Rackwitz 15.6k5 gold badges39 silver badges51 bronze badges asked Nov 20, 2024 at 11:57 Felix NFelix N 801 silver badge6 bronze badges 1- crosspost: forum.opencv./t/projectpoints-origin-projection-off-center/… – Christoph Rackwitz Commented Nov 20, 2024 at 12:47
1 Answer
Reset to default 1The image shape is (2988, 5312, 3), the big red dot is the image center at (1494, 2656)
You calibrated that camera, right? Then that's not the optical center. The optical center is in the camera matrix, along with the focal length.
(1476, 2732)
That looks more like it, although I'd have expected these numbers to also have digits after the decimal point.
本文标签: Python OpenCV projectPoints neutral position off centerStack Overflow
版权声明:本文标题:Python OpenCV projectPoints neutral position off center - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742359645a2460108.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论