我一直在使用OpenCV 3.0进行图像拼接项目。我像这样使用findHomography函数:

findHomography(imageOnePoints, imageTwoPoints, CV_RANSAC);

但是当我尝试编译代码时,返回以下错误消息:
stitch.cpp:111:75: error: ‘CV_RANSAC’ was not declared in this scope
 Mat homographyMatrix = findHomography(imageOnePoints, imageTwoPoints, CV_RANSAC);

stitch.cpp:111:84: error: ‘findHomography’ was not declared in this scope
 Mat homographyMatrix = findHomography(imageOnePoints, imageTwoPoints, CV_RANSAC);

我已经声明我正在使用“命名空间cv”,因此不需要前面的“cv::”。我不确定是什么问题。关于这些错误的任何建议将不胜感激。谢谢!

最佳答案

原来findHomography的头文件丢失了:

#include "opencv2/calib3d/calib3d.hpp"

09-25 21:29