SurfFeatureDetector core dumped

asked 2016-04-08 09:39:26 -0600

Razakhel gravatar image

updated 2016-04-10 07:55:29 -0600

I am trying to reproduce the code displayed here (it was an absolute pain to debug).

The actual code is:

int main(int argc, char* argv[]) {
    initModule_nonfree();

    Mat img_object = imread("/home/razakhel/Downloads/base.png" CV_IMREAD_GRAYSCALE);
    Mat img_scene = imread("/home/razakhel/Downloads/pattern.png" CV_IMREAD_GRAYSCALE);

    if (!img_object.data || !img_scene.data) {
        std::cout<< " --(!) Error reading images " << std::endl; return -1;
    }

    //-- Step 1: Detect the keypoints using SURF Detector
    int minHessian = 400;

    SurfFeatureDetector detector(minHessian);

    std::vector<KeyPoint> keypoints_object, keypoints_scene;

    detector.detect(img_object, keypoints_object); // <= Core dumped
    detector.detect(img_scene, keypoints_scene);

    [...]

    return 0;
}

The error appears on the line commented as such. The base.png is a 1366x768 picture (I tried with it rescaled to 640x380, same thing). The pattern.png is scaled at 205x180, but the code isn't reaching its import anyway. I assume it is unrelated to the size, but we never know.

I've been searching for answers for a while, but all I've been able to find was a problem related to the missing initModule_nonfree().

If anyone has an idea, I'd gladly try it.

edit retag flag offensive close merge delete

Comments

please try with grayscale images,

imread("/home/razakhel/Downloads/base.png", CV_IMREAD_GRAYSCALE)
berak gravatar imageberak ( 2016-04-10 07:27:49 -0600 )edit

My bad, actually I tried without the greyscale before posting in case it changed something, but it didn't. It doesn't work in either situation. I've updated the post!

Razakhel gravatar imageRazakhel ( 2016-04-10 07:57:02 -0600 )edit