Entry #9 Spot the Difference

Jamescgonzales
2 min readJan 30, 2021

--

Image Differencing

*image from : https://www.myhomeschoolmath.com
*image from : https://www.myhomeschoolmath.com

Back in the days when newspapers were a thing, people always go for the crossword puzzle. But for me, I quickly go to the “spot the difference” game, and as fast I can, I would search for all the difference as many as I can. Even if the game says it has ten different items, I would still look for more.

Now for this post, let’s take a rest from color segmentation for our region of interest. Instead of looking for color, we will be looking at the changes of position or shapes in our images.

To quickly determine the difference between the two values, we just subtract. And that’s what we will be doing on our image. But before that, as always, let’s load our python libraries

import numpy as np 
import matplotlib.pyplot as plt
from skimage.io import imread, imshow
from skimage.color import rgb2gray

Then let’s load the two images.

Let’s convert the two images to grayscale.

And as mentioned earlier, for image differencing we are just going to subtract the two images.

Highlighted above are the differences between the two images.

From the apple on the upper left to the tree on the upper right will total to ten differences. If there will be hundreds of differences to determine, the next step is to do image segmentation we learned from the previous posts.

Just a quick reminder when making image differences, confirm the shape of both the images before subtracting the two.

I hope you enjoy this short post as I do.

--

--