Fatal signal 11 (SIGSEGV), code 2 from knnMatch in OpenCV4Android 3.2

asked 2017-01-14 04:06:32 -0500

wes.y.w. gravatar image

I'm trying to do a pretty simple feature matching project but am running into this line here causes Fatal signal 11 (SIGSEGV), code 2, fault addr 0x12c4f000 in tid 10135 (Thread-3960) from OpenCV 3.2.0. Basically I am calling ORB on two images, and then BFMatcher. I have the same code working in OpenCV 3.2.0 C++, and OpenCV4Android 2.4.9. Is this a bug with 3.2.0? Code below:

    ORB featureDetector = ORB.create(300, 1.2f, 4, 31, 0, 2, ORB.HARRIS_SCORE, 31, 20);
    BFMatcher descriptorMatcher = BFMatcher.create(BFMatcher.BRUTEFORCE_HAMMING,false);
    MatOfKeyPoint keyPoints1 = new MatOfKeyPoint();
    MatOfKeyPoint keyPoints2 = new MatOfKeyPoint();
    Mat testDescriptor1 = new Mat();
    Mat testDescriptor2 = new Mat();

    List<MatOfDMatch> nn_matches = new ArrayList<MatOfDMatch>();

    featureDetector.detect(Img1, keyPoints1);
    featureDetector.detect(Img2, keyPoints2);

    featureDetector.compute(Img1, keyPoints1, testDescriptor1);
    featureDetector.compute(Img2, keyPoints2, testDescriptor2);

    descriptorMatcher.knnMatch(testDescriptor1, testDescriptor2, nn_matches, 2);  // crash here
edit retag flag offensive close merge delete