Ask Your Question

Charlie Murphy's profile - activity

2018-12-11 10:57:43 -0600 received badge  Popular Question (source)
2015-02-24 21:30:53 -0600 asked a question FeatureDetector for SURF


I was wondering if it is possible to specify the Hessian threshold for the surf detector in the FeatureDetector class

cv::Mat image;
//get the image
cv::Ptr<cv::FeatureDetector> surf_detector;
surf_detector = FeatureDetector::create("SURF");
// I would like to set the Hessian threshold to 400
vector<cv::KeyPoint> keypoints;
surf_detector->detect(image, keypoints);

Or Will I need to continue using the cv::SurfFeatureDetector class and initialize it with the proper value?

while this specifically asks about the SURF detector, I'd like to know if it is possible to pass parameters to the underlying detector class. AKA specify the hessian value for surf, set non-maximal suppression for fast detector, and so on.

2014-07-14 06:58:10 -0600 commented question OpenCV 2.4.8 Ubuntu 14.04 imshow QMetaMethod::invoke Freeze

Hi Steven, I forgot to mention but I also used a source installed version of Opencv 2.4.8. I think I've found the why of the program crash but not the how to fix (other than rewriting the program to have a specific thread for imshow). I was reading another persons problem that was similar and it seems imshow is not threadsafe as in problems occur when you try to update the same window from different threads.

2014-07-13 16:45:48 -0600 asked a question OpenCV 2.4.8 Ubuntu 14.04 imshow QMetaMethod::invoke Freeze

I've installed OpenCV 2.4.8 (libopencv-dev) by using apt-get and receive the following message.

init done opengl support available QMetaMethod::invoke: Unable to invoke methods with return values in queued connections.

I ran the program in gdb and it actually seems to stop and freeze on calling cv::waitKey(30); however, the problem only occurs when I call cv::imshow and it seems to be only when imshow is called in a callback function (in a single threaded program that had imshow in a loop did not exhibit the same problems).

Here is the backtrace:

#0  0x00007ffff27f8d7d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007ffff376d3c8 in ros::ros_wallsleep(unsigned int, unsigned int) ()
   from /opt/ros/indigo/lib/
#2  0x00007ffff4890877 in ros::waitForShutdown() () from /opt/ros/indigo/lib/
#3  0x00007ffff48ac2f8 in ros::MultiThreadedSpinner::spin(ros::CallbackQueue*) ()
   from /opt/ros/indigo/lib/
#4  0x0000000000412267 in CM::Robot::Robot (this=0x7fffffffd210, handle=..., mod=...)
    at /home/charlie/turtlebot/packages/mapping/src/
#5  0x000000000041f128 in main (argc=1, argv=0x7fffffffd468)
    at /home/charlie/turtlebot/packages/mapping/src/

Here is the output. I added a few cout statements to help decide exactly where the program was freezing.

init done 
opengl support available 
QMetaMethod::invoke: Unable to invoke methods with return values in queued connections

Here is a simplified version of the code that produces the problem: robot.h

# necessary include statements...
(opencv specific includes)
#include <opencv2/core/core.hpp>
#include <opencv2/nonfree/nonfree.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <highgui.h>

Robot {
  Robot(ros::NodeHandle& handle, const std::string& mod): node(handle), mode(mod){
   ros::MultiThreadedSpinner threads(3);
   ros::Subscriber odom  = node.subscribe("/odom", 1, &Robot::get_pose, this);
   ros::Subscriber cloud = node.subscribe("/camera/depth/points", 1, &Robot::add_cloud, this);
  void get_pose(nav_msgs::Odometry data){
  void add_cloud(sensor_msgs::PointCloud2 cloud){
   PointCloud::Ptr cl(new(PointCloud));
   pcl::fromROSMsg(cloud, *cl);
   cl->width = 640;
   cl->height = 480;
  void extract_surf_features(pcl::PointCloud<pcl::PointXYZRGB>::Ptr points){
   cv::Mat image(cur->height, cur->width, CV_8UC3);
   (... get 2d rgb image from point cloud ...)
   cv::SURF surf_extractor(500.0); // Hession threshold = 500.0
   std::vector<cv::KeyPoint> keypoints;
   // actually compute the surf keypoints
   surf_extractor(image, cv::Mat(), keypoints);
   cv::drawKeypoints(image, keypoints, image, cv::Scalar::all(-1), cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
   cout << "Before\n";
   cv::imshow("Image", image);
   cout << "Between\n";
   cout << "After\n";
  ros::NodeHandle node;
  std::string mode;

#include <ros/ros.h>
#include <iostream>
#include "robot.h"

using namespace std;

int main(int argc, char** argv){
 ros::init(argc, argv, "PCL_Map");
 if (!ros::master::check()){
  cout << "\033[1;31mERROR: ROS Master not found. Please Start ROS.\n\033[0m";
  return -1;
 ros::NodeHandle node("/map/pcl");

 node.setParam("downsample", 0.04);

 CM::Robot robot(node,"SURF");

 return 0;

I have written another very similar program that does not exhibit the freezing behaviors ... (more)