In the previous post, we discussed one technique to check the overlap between two given images of equal dimensions. In today’s post, let us look at another idea that uses Mathematica’s ImageCorrespondingPoints function.

As per the documentation, the ImageCorrespondingPoints function finds a set of matching interest points between two given images and returns their coordinates. Internally it uses the ImageKeyPoints function to determine the key points of each image.

First, let us write a function that will highlight the corresponding points on a given pair of images.

Corresponding Points

When applied to our image sets, we get the highlighted pairs as below:

Corresponding Points Highlighted

As expected, this technique shows very little overlap between image1 and image4 (in contrast to the previous technique).

An interesting variation of highlighting is to number the matching points so that we can see exactly which point is where in each image. Here is the function to do that (we restrict the number of points shown in order to prevent clutter):

Numbering Points

The corresponding visualization of two images is here:

Visualize Numbered Points

Let us now write a function to compute the overlap:

Compute Overlap

I have chosen the scale factor constant to bring the actual ratio close to what is perceived visually. This is a trial and error process.

Here is the computed overlap percentage for the different image pairs:

Overlap Percentages

I feel this technique gives a better estimate of image overlap compared to the technique we saw in the previous post.