DescriptioMatcher.radiusMatch failed Assertion in Opencv 2.4.4 Java (Bug #2901)


Added by Christian Bodenstein almost 12 years ago. Updated almost 12 years ago.


Status:Done Start date:
Priority:Normal Due date:
Assignee:Andrey Pavlenko % Done:

0%

Category:java bindings
Target version:2.4.5
Affected version:2.4.4 Operating System:
Difficulty: HW Platform:
Pull request:https://github.com/Itseez/opencv/pull/769

Description

Hi there,

i wanted to use the Java bindings, to make some obejct recognition. But when I try to use the radiusmacth function, it throws an error when it trys to convert the matches Mat into a List<DMatch>.

her is a part of my Code:

DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.ORB);

Mat descriptors_1 = Mat.zeros(1, k1.size(), CvType.CV_32F);
Mat descriptors_2 = Mat.zeros(1, k2.size(), CvType.CV_32F);
MatOfKeyPoint keypoints1 = new MatOfKeyPoint(k1.toArray(new KeyPoint[k1.size()]));
MatOfKeyPoint keypoints2 =  new MatOfKeyPoint(k2.toArray(new KeyPoint[k2.size()]));
System.out.println("Descripting....");
extractor.compute( image1, keypoints1, descriptors_1 );
extractor.compute( image2, keypoints2, descriptors_2 );

DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMINGLUT);
List<MatOfDMatch> m = new ArrayList<MatOfDMatch>();
System.out.println("Matching....");
matcher.radiusMatch(descriptors_1, descriptors_2 ,m, 10);

And here the stacktrace:

Exception in thread "main" java.lang.IllegalArgumentException: Incomatible Mat
    at org.opencv.core.MatOfDMatch.<init>(MatOfDMatch.java:31)
    at org.opencv.utils.Converters.Mat_to_vector_vector_DMatch(Converters.java:690)
    at org.opencv.features2d.DescriptorMatcher.radiusMatch(DescriptorMatcher.java:561)
    at com.bodix.cv.SfMOL.findMatchingFeature(SfMOL.java:92)
    at SimpleSample.main(javatest.java:27)

Do you know any workaround for this until this is fixed???


Associated revisions

Revision 09fe5cdd
Added by Andrey Pavlenko almost 12 years ago

test for the issue #2901

Revision 4c31c26a
Added by Andrey Pavlenko almost 12 years ago

fix for #2901 (en exception was raised when getting empty MatOfDMatch)

History

Updated by Daniil Osokin almost 12 years ago

  • Category set to java bindings

Updated by Daniil Osokin almost 12 years ago

  • Assignee set to Andrey Pavlenko

Updated by Andrey Pavlenko almost 12 years ago

Fixed: an exception was raised when getting empty `vector<DMatch>` from native level.

  • Pull request set to https://github.com/Itseez/opencv/pull/769
  • Start date deleted (2013-03-21)

Updated by Andrey Kamaev almost 12 years ago

  • Target version set to 2.4.5

Updated by Andrey Kamaev almost 12 years ago

Fix is pushed to 2.4

  • Status changed from Open to Done

Also available in: Atom PDF