Reputation: 71
Dears 1-I know the Point class is regarding two channel integer value coordinates(points): like MatOfPoint is a vector of integer points. Is it the same with the KeyPoint class? I know It is a class containing salient points.Is it true to look at them as two channel float value coordinates(points)? Look at the lines below:
KeyPoint test;
test= new float[]{x,y};
I wrote them to see if my interpretation regarding KeyPoint is valid. Please validate this.
2-what is Dmatch match.trainIdx? I mean what is trainIdx?
Peace
Upvotes: 1
Views: 775
Reputation: 1483
KeyPoint stores salient points description. It stores x, y, angle, size etc. See http://docs.opencv.org/java/2.4.2/org/opencv/features2d/KeyPoint.html
The correct way to manually initialize it in Java will be:
KeyPoint test = new KeyPoint(x, y, size);
or to get a list of keypoints for image :
Mat srcImage;
MatOfKeyPoint keypoints;
Mat descriptors;
DescriptorExtractor descExctractor = DescriptorExtractor.create(DescriptorExtractor.SIFT);
descExctractor.compute(srcImage, keypoints, descExctractor);
KeyPoint[] keyPointsArray = keypoints.toArray()
DMatch constains a description of a matching keypoint descriptors. See http://docs.opencv.org/java/2.4.2/org/opencv/features2d/DMatch.html
It is returned by DescriptorMatcher implementation (match, knnmatch, radiusmatch functions). You pass matrixes queryDescriptors and trainDescriptors to one of these functions.
trainIdx is a row index in trainDescriptors which is closest to a given descriptor in queryDescriptors.
I'd suggest reading original OpenCV description and examples for C++, Java provides only mapping to C++ functionality through JNI.
Upvotes: 2