Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

SurfFeatureDetector core dumped

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");
    Mat img_scene = imread("/home/razakhel/Downloads/pattern.png");

    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.

SurfFeatureDetector core dumped

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");
imread("/home/razakhel/Downloads/base.png" CV_IMREAD_GRAYSCALE);
    Mat img_scene = imread("/home/razakhel/Downloads/pattern.png");
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.