How to find a part of an image with the highest density of feature matches
As the title says, I want to find the position with the most feature matches from an image. What I'm looking for is the part of the image where the feature matches have the highest density. I know that the question can be easily misunderstood, therefore I added a photo describing better what I mean.
In the end I want to have a rectangle around the position with the most feature points within, where the max distance between 2 nearest points should be smaller than a threshold. In the image added I've manually drawn a rectangle around the area with the highest density of feature points.
I could implement a not so efficient way, but I would like to know if there's any OpenCV function that could be useful or if someone knows a smart way to do it. Thank you!