Ask Your Question

wes.y.w.'s profile - activity

2017-01-17 20:40:55 -0500 received badge  Enthusiast
2017-01-14 04:06:32 -0500 asked a question Fatal signal 11 (SIGSEGV), code 2 from knnMatch in OpenCV4Android 3.2

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
2017-01-09 20:53:56 -0500 commented answer cannot save SVM in OpenCV4Android 3.2 after upgrade: Fatal signal 11

thanks, @alexander33, but as @berak pointed out, this error seems to be specific to java.

2017-01-08 21:04:27 -0500 asked a question DescriptorMatcher reports good matches even when object is not in the scene

I'm trying to detect a known object by comparing the current frame in a video against pre-stored feature descriptors. My thought is to match the features of the current frame against the prestored features, and report a positive detection when the number of good features is above some threshold.

This, however, doesn't seem to work because DescriptorMatcher will always report a certain fixed number of matches regardless of whether the object is actually in the scene. Even though I use a pretty conventional filtering approach to keep the top x number of good matches, it's still a metric that's relative to the current frame.

Is there something like goodness of match from DescriptorMatcher that I can potentially use as a hard threshold? Is there a better approach to this? I have used Bag of Words before but it seems a bit overkill for the problem at hand, also it's a bit too computational exhaustive for my needs. Any suggestions/tips/pointers would be appreciated.

ImageDescriptor imageDescriptor = null;
imageDescriptor = ImageDescriptor.fromJson(jsonMetadata);
Mat storedDescriptors = imageDescriptor.getFeatureDescriptors(); // prestored features

FeatureDetector featureDetector = FeatureDetector.create(FeatureDetector.ORB);
DescriptorExtractor descriptorExtractor = DescriptorExtractor.create(DescriptorExtractor.ORB);
DescriptorMatcher descriptorMatcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);

MatOfKeyPoint keyPoints = new MatOfKeyPoint();
featureDetector.detect(rgba, keyPoints);  // rgba is the image from current video frame

MatOfDMatch matches = new MatOfDMatch();
Mat currDescriptors = new Mat();

descriptorExtractor.compute(rgba, keyPoints, currDescriptors);
descriptorMatcher.match(descriptors_scene, storedDescriptors, matches);

MatOfDMatch good_matches = filterMatches(matches); // filterMatches return the matches that have a distance measure of < 2.5*min_distance

    return true;

return false;
2017-01-08 14:14:56 -0500 asked a question cannot save SVM in OpenCV4Android 3.2 after upgrade: Fatal signal 11

I just upgraded to 3.2.0 from 2.4.9 and it seems like the save function is broken? All I did was change CvSVM to SVM

SVM svmClassifier = SVM.create(); 
File svm_file = new File(dir, "svm_test.xml");;

will now report A/libc: Fatal signal 11 (SIGSEGV) at 0x644e98f8 (code=2), thread 2380 (Thread-6433). The same flow worked fine with 2.4.9 and CvSVM. Help?