我正在尝试使用 opencv 3.0 运行 rgbdodometry 示例。
https://github.com/kipr/opencv/blob/master/samples/cpp/rgbdodometry.cpp
我在这里遇到异常错误:(第 46 行)
static void warpImage(const Mat& image, const Mat& depth, const Mat& Rt, const Mat& cameraMatrix, const Mat& distCoeff, Mat& warpedImage)
perspectiveTransform(cloud, transformedCloud, Rt);
Assertion failed <scn +="" 1="=" m.cols=""> in cv::perspectiveTransform. file matmul.cpp, line 2125
Rt Mat 似乎保持为空,而 perspectiveTransform 需要 3 x 3。我正在使用示例中的代码和示例文件夹中的图像。
这是怎么回事?我该如何修复它?
最佳答案
这是因为 Mat Rt 没有填满。由于此行在 opencv 3 中失败。
bool isFound = cv::RGBDOdometry(Rt, Mat(),
grayImage0, depthFlt0, Mat(),
grayImage1, depthFlt1, Mat(),
cameraMatrix, minDepth, maxDepth, maxDepthDiff,
iterCounts, minGradMagnitudes, transformationType);
它需要添加 rgbd::RGBDOdometry 命名空间,但是当我添加它时,它无法编译。我已经回到 2.4,它运行完美。
关于c++ - cv::perspectiveTransform 断言失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30698797/