提示原因:surf、sift等算法涉及到专利问题,编译时看控制台输出窗口,发现提示This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function ‘cv::xfeatures2d::SIFT::create’。
解决方法:重新cmake一次,在cmake时勾选OPENCV_ENABLE_NONFREE可以解决。