gpt4 book ai didi

c++ OpenCV CVCalibrateCamera2 导致多个错误

转载 作者:太空宇宙 更新时间:2023-11-03 23:04:41 25 4
gpt4 key购买 nike

我正在使用 OpenCV 在 C++ 中制作一个简单的校准程序。在我真正尝试调用 CVCalibrateCamera2 之前,一切都很顺利。此时,我得到了几个错误之一:

如果我使用的图像数量等于 4(这是从每个图像中绘制的点数:

OpenCV Error: Sizes of input arguments do not match (Both matrices must have the same number of points) in unknown function, file ......\src\cv\cvfundam.cpp, line 870

如果图像数量低于 20:

OpenCV Error: Bad argument (The total number of matrix elements is not divisible by the new number of rows) in unknown function, file ......\src\cxcore\cxarray.cpp, line 2749

否则,如果图片数量为20张或以上:

OpenCV Error: Unsupported format or combination of formats (Invalid matrix type) in unknown function, file ......\src\cxcore\cxarray.cpp, line 117

我已经多次检查了 CVCalibrateCamera2 的参数,我确信它们的相对尺寸是正确的。程序似乎在某个地方试图根据图像数量 reshape 矩阵,但我不知道在哪里或为什么。有任何想法吗?我正在使用 Eclipse Galileo、MINGW 5.1.6 和 OpenCV 2.1。

最佳答案

我对此不是 100% 确定,但我认为您的对象点不能共线。在你的代码中,你有

const float points [] [2] = {{0, 0}, {1, 0}, {2, 0}, {3, 0}};

这些点都在同一条直线上(x 轴)。我认为对象点必须为 cvCalibrateCamera2 工作定义一个平面。这可能会解释您看到的错误。

据我所知,OpenCV 校准例程主要设计用于棋盘图案(或其他一些平面对象点集),我不知道相同的算法是否适用于您的情况。

关于c++ OpenCV CVCalibrateCamera2 导致多个错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3026495/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com