Pergunta

I am trying to use openCV's SIFT feature detector using C++ on a mac and I keep getting the following error:

siftTest.cpp: In function ‘int main(int, char**)’: 
siftTest.cpp:7: error: ‘SIFT’ is not a member of ‘cv’ 
siftTest.cpp:7: error: expected `;' before ‘detector’

My code is:

#include <opencv2/opencv.hpp>
#include <iostream>

int main (int arg, char *argv[]) {
   cv::Mat image = cv::imread("fox.jpg", 1);

   cv::SIFT detector(0, 3, 0.04, 0, 1.6);
   cv::vector<cv::KeyPoint> keypoints;

   cv::namedWindow("=^..^= FOX =^..^=");
   cv::imshow("=^..^= FOX =^..^=", image);
   cv::waitKey();
   return 0;
}

I'm probably just not importing something, but I can't find the right thing / right combination of things to get it to work.

Thanks

Foi útil?

Solução

SIFT and SURF were moved to nonfree module. You need to add

#include <opencv2/nonfree/nonfree.hpp>

header and link with opencv_nonfree library.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top