I'm struggling with some C++ code I'm trying to convert to Java/Scala. The original was:
std::vector<std::vector<cv::DMatch> > matches;
cv::Ptr<cv::DescriptorMatcher> descriptorMatcher;
descriptorMatcher = new cv::BruteForceMatcher<cv::HammingSse>();
descriptorMatcher->radiusMatch(descriptors2,descriptors,matches,100.0);
The Java/Scala looks like this:
val matches = new java.util.ArrayList[MatOfDMatch]
val matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING)
matcher.radiusMatch(descriptors2, descriptors1, matches, 100F)
When this is run I'm getting the error:
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)
Looks like the code is using checkVector to validate that the inner Mat's returned by the underlying C++ code are a vector and they obviously aren't. But the C++ works so why not the Java? Any help/advice much appreciated.