error: (-205:Formats of input arguments do not match) All the matrices must have the same data type

最近在使用opencv进行内外参标定的时候,在调用solvePnp和projectPoints时,出现了以下错误:

error: (-205:Formats of input arguments do not match) All the matrices must have the same data type

我反复检查,发现内外参矩阵的值没有问题,那为什么会报错呢?最终看函数定义才知道,这两个函数对矩阵的格式要求都是double,而我定义成了float,因此会报错。

cv::Mat rvec(3, 3, cv::DataType<double>::type); //这是正确的
cv::Mat rvec(3, 3, cv::DataType<float>::type);//这是错误的

猜你喜欢

转载自blog.csdn.net/qq_29462849/article/details/88756253
今日推荐