Ask Your Question

pooshak's profile - activity

2020-09-28 10:47:47 -0600 received badge  Student (source)
2018-10-09 15:15:51 -0600 commented answer Segmentation fault with ORB feature extractor

Thank you so much! You saved me haha However, can I ask why we should never use raw pointers with openCV?

2018-10-09 15:15:20 -0600 commented answer Segmentation fault with ORB feature extractor

Thank you so much! You saved me haha

2018-10-09 15:14:58 -0600 received badge  Supporter (source)
2018-10-09 15:14:56 -0600 marked best answer Segmentation fault with ORB feature extractor

Hi, I've written a bit of code which takes an image, detects keypoints with using FAST (as shown below) and the resulting keypoints are passed over to an ORB feature detector. However, despite checking the image to be not empty and having a lot of keypoints, I get a weird segmentation fault whenever I try and run it.

class Code{
  //ROS node init removed for brevity
  Ptr<cv::FastFeatureDetector> detector = cv::FastFeatureDetector::create(detector_set_input);
  DescriptorExtractor* extractor = cv::ORB::create();
  std::vector<KeyPoint> keypoints_last;
  Mat descriptors_last;

public:
  void callback(const sensor_msgs::ImageConstPtr& msg)
  {
    cv_bridge::CvImagePtr cv_ptr;
    cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8);   //try/excepts cut down for brevity
    Mat img = cv_ptr->image;
    detector->detect(image, keypoints_last);   //This line never throws bugs
    extractor->compute(gray_lastimage, keypoints_last, descriptors_last);    //Segmentation fault here
  }
};

Details: callback is a ROS node callback function, and the image is converted from a sensor_msg to a cv::Mat using cv_bridge, but I don't think that's where the error is coming from or it probably wouldn't have detected any keypoints.

descriptors_last and keypoints_last are empty here- the issue comes from when the node is trying to initialize.

I'm using openCV3.3 on Ubuntu 16.04 with ROS Kinetic.

Many thanks!

2018-10-09 15:14:56 -0600 received badge  Scholar (source)
2018-10-09 09:33:15 -0600 asked a question Segmentation fault with ORB feature extractor

Segmentation fault with ORB feature extractor Hi, I've written a bit of code which takes an image, detects keypoints wit