当我在调试器下运行我的代码时,它显示了< unknown>错误:
detector-> detectAndCompute(matInput,noArray(),keypoints2,descriptors2);像这样
matInput来自`inputFrame ….
matInput
要缩小范围,请尝试拆分 detectAndCompute() 成 detect() 和 compute() :
detectAndCompute()
detect()
compute()
#include <stdio.h> #include <iostream> #include "opencv2/core.hpp" #include "opencv2/features2d.hpp" #include "opencv2/xfeatures2d.hpp" #include "opencv2/highgui.hpp" using namespace cv; using namespace cv::xfeatures2d; std::vector<cv::KeyPoint> keypoints2; cv::Mat descriptors2; static void createKeypointsAndDescriptors(const cv::Mat& matInput) { //-- Step 1: Detect the keypoints using SURF Detector, compute the descriptors double minHessian = 400; Ptr<SURF> detector = SURF::create(); detector->setHessianThreshold(minHessian); detector->detect(matInput, keypoints2); detector->compute(matInput, keypoints2, descriptors2); // detector->detectAndCompute( matInput, noArray(), keypoints2, descriptors2 ); ... }
cv::xfeatures2d::SURF Class Reference cv::Feature2D Class Reference cv::xfeatures2d::AffineFeature2D Class Reference
cv::xfeatures2d::SURF Class Reference
cv::Feature2D Class Reference
cv::xfeatures2d::AffineFeature2D Class Reference