Ask Your Question
0

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

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

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

Comments

I'm getting the same error.

2020-02-05 03:45:03.783 14560-14560/? A/DEBUG: pid: 14404, tid: 14404, name: m.app.toomuchai >>> com.app.toomuchai <<< 2020-02-05 03:45:04.068 14560-14560/? A/DEBUG: #00 pc 00000000009c0f0c /data/app/com.app.toomuchai-xtVh7mhXXFebN7yS4RDDlw==/lib/arm64/libopencv_java3.so (_ZNK2cv17DescriptorMatcher8knnMatchERKNS_11_InputArrayES3_RSt6vectorIS4_INS_6DMatchESaIS5_EESaIS7_EEiS3_b+72) 2020-02-05 03:45:04.068 14560-14560/? A/DEBUG: #01 pc 00000000001d6bf4 /data/app/com.app.toomuchai-xtVh7mhXXFebN7yS4RDDlw==/lib/arm64/libopencv_java3.so (Java_org_opencv_features2d_DescriptorMatcher_knnMatch_12+120) 2020-02-05 03:45:04.068 14560-14560/? A/DEBUG: #09 pc 0000000000261ca4 /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.app.toomuchai-xtVh7mhXXFebN7yS4RDDlw==/base.apk (deleted) (org.opencv.features2d.DescriptorMatcher.knnMatch+28) 2020-02-05 03:45:04.068 14560-14560/? A/DEBUG: #15 pc 000000000001df26 /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/com.app.toomuchai-xtVh7mhXXFebN7yS4RDDlw==/base.apk!classes2.dex (deleted) (com.app.toomuchai.CameraService.img_similarity+118) 2020-02-05 03:45:04.068 14560-14560/? A/DEBUG: #21 pc 000000000001eac8 ...

(more)
zzxjl1 gravatar imagezzxjl1 ( 2020-02-04 13:39:55 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-02-04 14:41:44 -0600

zzxjl1 gravatar image

Problem solved after changing BFMatcher bf = new BFMatcher(Core.NORM_HAMMING); to DescriptorMatcher bf = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-01-14 04:06:32 -0600

Seen: 492 times

Last updated: Feb 04 '20