Ask Your Question
0

error: ‘SurfFeatureDetector’ is not a member of ‘cv’

asked 2013-02-25 11:45:17 -0600

superawesomepandacat gravatar image

updated 2013-02-25 11:46:18 -0600

I'm trying to work out how to use OpenCV on ROS.

I've gone through the cv_bridge tutorial and understand how to convert to the sensor_msgs::Image to the format used by OpenCV, in order to use the image with OpenCV libraries, and convert it back to sensor_msgs::Image. And by the cv::circle and cv::NamedWindow examples in the cv_bridge tutorial, I assumed that I can use the algorithms in the OpenCV documentation by referring to the cv namespace.

So I decided to write a simple program to try out the feature detector algorithms in OpenCV, referring to http://docs.opencv.org/doc/tutorials/features2d/feature_detection/feature_detection.html. And got to this point:

#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <cv_bridge/cv_bridge.h>
#include <sensor_msgs/image_encodings.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>

int main(int argc, char** argv)
{
  ros::init(argc, argv, "panda");

  cv::Mat image;

  image = cv::imread(argv[1], 0);

  int minHessian = 400;
  cv::SurfFeatureDetector detector( minHessian );

  while(ros::ok())
  {
  cv::namedWindow( "Display window");

  cv::imshow( "Display window", image );
  cv::waitKey(3);
  }

  return 0;

}

But I got an error:

error: ‘SurfFeatureDetector’ is not a member of ‘cv’

It works with the cv::SurfFeatureDetector line commented out. I'm stuck at that point. I don't think I'm missing any headers. Any help?

Please and thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2013-02-25 11:50:55 -0600

superawesomepandacat gravatar image

Oh, just found the solution here: http://stackoverflow.com/questions/9968993/opencv-undefined-reference-surffeaturedetector-and-bruteforcematcher

"#include <opencv2/nonfree/features2d.hpp>"
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-02-25 11:45:17 -0600

Seen: 3,908 times

Last updated: Feb 25 '13