Jigsaw Search In Image

Kevin FOO
2 min readAug 26, 2021

In my previous article, I compared two images of the same size pixel by pixel. To further enhance its functionality, I now search for a small image (I’m going to call it a jigsaw) in the big image pixel by pixel and return the coordinates of the top left corner pixel location.

a.png

I cropped a 36x36 image from a.png and named it c.png

c.png

After that I edited c.png and named it d.png so that the jigsaw could not be found anymore.

d.png

It takes ~11 seconds to search for a 36x36 pixel jigsaw in a 360x360 image. Next I convert all the images into grayscale and name it ag.png, cg.png and dg.png

convert a.png -type grayscale ag.png
ag.png
cg.png
dg.png

Now lets retest the search with the grayscale images.

It seems that it is faster with grayscale images, it took about ~4 seconds to search.

Related articles

Image Compare By Pixels
Needle In Haystack Search (version 2)

< Back to all the stories I had written

--

--

Kevin FOO

A software engineer, a rock climbing, inline skating enthusiast, a husband, a father.