1

Using OpenCV SIFT algorithm i am able to get the matching and non matching feature points between 2 images. My solution is here
The distribution of matched(green) and non-matched(red) feature points is as shown below.(i cant reveal the actual image. but the image contains mostly text) enter image description here I want to calculate a density function for the matching and non matching points on an image(i.e. given a nXn area on the image, density function should give how many matching points are present inside this nXn area). How can i do that?
Secondly, i want to calculate a function that gives ratio of densities of matching and non-matching feature points inside a nXn area on the image.
I am using Python code on Windows 7 and build from latest OpenCV source.

Community
  • 1
  • 1
uzair_syed
  • 313
  • 3
  • 16

1 Answers1

1

To compute the densities of matching and non-matching keypoints you could divide your image in sub-squares of a given size and calculate the two densities on each square. See the example below:

local densities on a given square This would allow to discretize the densities on surfaces of the same area. To calculate the densities of a given square, you can do the following:

  • Create a Rect(x ,y, width, height) object corresponding to the square.
  • Loop over all the non-matching keypoints and check how many of them are contained in the Rect (you can use Rect.contains(Point)).
  • Repeat the previous step for the matching keypoints.
  • Compute the densities (Keypoints per square pixel) like shown in my example picture.

N.B. Actually, Rect only exists in OpenCV C++, so you can re-create a Rect (and its contains method) class in Python if you want (it is not required though).

Elouarn Laine
  • 1,665
  • 15
  • 27