Ask Your Question

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

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

superawesomepandacat gravatar image

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

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 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 );

  cv::namedWindow( "Display window");

  cv::imshow( "Display window", image );

  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

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

superawesomepandacat gravatar image

Oh, just found the solution here:

"#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


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

Seen: 3,962 times

Last updated: Feb 25 '13