该死的编码问题:OpenCV(3.4.5) Error: Assertion failed (!_src.empty()) in cv::cvtColor, file E:\opencvBuil......

opencv3.4.5添加contrib后,使用sift算法做特征点识别时报错,之前以为是opencv编译过程中设置不对,亦或是版本问题,又重新编译了好几遍,都还是遇到同样的问题。

该死的编码问题:OpenCV(3.4.5) Error: Assertion failed (!_src.empty()) in cv::cvtColor, file E:\opencvBuil......_第1张图片
#include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/xfeatures2d.hpp"
#include 
#include 

using namespace cv;
using namespace std;
using namespace xfeatures2d;
void main()
{
    Mat matSrc = imread("C:\\Users\\Administrator\\Desktop\\lena.jpg");
    Mat gray;
    Mat draw;
    cvtColor(matSrc, gray, CV_RGB2GRAY);
    Mat descriptors;
    namedWindow("lena");
    imshow("lena", matSrc);
    std::vector 

你可能感兴趣的:(该死的编码问题:OpenCV(3.4.5) Error: Assertion failed (!_src.empty()) in cv::cvtColor, file E:\opencvBuil......)