2016-03-22 58 views
1

我正在使用Visual Studio 2010与OpenCV 3.0。我想校准一台摄像机,而且我基本上在去年的帖子this中描述了相同的问题,但没有回复。我打电话给calibrateCamera,并且在cv :: collectCalibrationData中收到错误“Assertion failed(ni == ni1)”。OpenCV calibrateCamera声明失败(ni == ni1)

的是得到这个错误代码行是:

double rms = calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, s.flag | CALIB_FIX_K4 | CALIB_FIX_K5); 

我已经检查都objectPoints和imagePoints的大小,和他们是一样的。这似乎是向量转换为InputArrayOfArrays时的错误。我已经写了下面的代码给它找出来:

cv::InputArrayOfArrays IMGPOINT = imagePoints; std::cout << (int) IMGPOINT.total() << std::endl; 
cv::InputArrayOfArrays OBJPOINT = objectPoints; std::cout << (int) OBJPOINT.total() << std::endl; 

for(int i = 0; i < 3; ++i){ 
    std::cout << OBJPOINT.getMat(i).checkVector(3, CV_32F) << std::endl; 
    std::cout << IMGPOINT.getMat(i).checkVector(2, CV_32F) << std::endl; 
} 

它打印出来:

5 
5 
48 
48 
174912 
16 
788167652 
111826623 

当我倾向于认为它应该打印下一:

5 
5 
48 
48 
48 
48 
48 
48 

由于我已经描述过,每次运行程序时都会出现一个随机整数 - 它们不一致,永远不会彼此相等。我不知道为什么collectCalibrationData获取我的向量大小的错误值,以及为什么将向量转换为InputArrayofArrays似乎会改变它们的大小。对此有何想法?

在此先感谢。

回答

0

我用Cmake重建库后解决了这个问题。我使用了OpenCV 3.0。

相关问题