I need to get coordinates of each matched keypoint int helist of DMatch classes
However, each DMatch only contains the distance in pixels between matched keypoints and no coordinates in either image 1 or image 2.
How can I get coordinates so I can compute transformations?
private static boolean switch_image = false;
private static Mat descriptors1 = new Mat();
private static Mat descriptors2 = new Mat();
private static MatOfKeyPoint keypoints1 = new MatOfKeyPoint();
private static MatOfKeyPoint keypoints2 = new MatOfKeyPoint();
public static Mat process(Mat img){
lock.lock();
ORB detector = ORB.create();
if(switch_image) {
detector.detect(img, keypoints1, new Mat());
switch_image = false;
detector.detectAndCompute(img, new Mat(), keypoints1, descriptors1);
}
else
{
detector.detect(img, keypoints2, new Mat());
switch_image = true;
detector.detectAndCompute(img, new Mat(), keypoints2, descriptors2);
}
DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);
MatOfDMatch matches = new MatOfDMatch();
MatOfDMatch filteredMatches = new MatOfDMatch();
matcher.match(descriptors1, descriptors2, matches);
List<DMatch> matchesList = matches.toList();
Mat output=new Mat();
Features2d.drawKeypoints(img, keypoints1,output );
lock.unlock();
return output;
}