# Find average distance between 2 matched keypoints (after using findHomography() mask) c++

I'm trying to calculate the average distance along x and y axis between 2 matched keypoints. I followed the following steps:

- I calculated keypoints thanks to the ORB class (vector keypoint_1, keypoint2;)
- I matched keypoints thanks to BFMatcher.match()
- I obtained a better result thanks to the min_dist method
- I got a mask between 2 images using findHomography(img_1, img_2, RANSAC, 3, mask)

Now that I have the mask I just made a for loop, that evaluate every point in the mask that are equal to 1: when this happens I'm supposed to calculate the (average) distance along x and y axis of this matched points, but I'm stuck and don't know how to do that. Thanks everyone for the help!