# How do I get DMatch coordinates in Java from Feature Detector?

**URL:** <https://forum.opencv.org/t/how-do-i-get-dmatch-coordinates-in-java-from-feature-detector/12342>\
**Category:** Uncategorized\
**Tags:** features2d\
**Created:** [March 13, 2023, 5:58pm UTC](https://forum.opencv.org/t/how-do-i-get-dmatch-coordinates-in-java-from-feature-detector/12342 "2023-03-13T17:58:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mich\_Po](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mich_po/32/7372_2.png) [@Mich\_Po](https://forum.opencv.org/u/Mich_Po)\
**Post date:** [March 13, 2023, 5:58pm UTC](https://forum.opencv.org/t/how-do-i-get-dmatch-coordinates-in-java-from-feature-detector/12342/1 "2023-03-13T17:58:53Z")

</div>

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?

```auto
   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;
    }

```
