Hello Everyone,
I’m trying to do the Lynda.com “code clinic” challenges.
I’m stuck on the image comparison challenge and could use some help.
This is my solution so far.
And here are the images I’m comparing - credit to Lynda.com for the images:
The goal:
Find a “needle” in a “haystack.”
Both the “needle” and the “haystack” are images.
My approach: take the top left pixel of the needle, then compare that to every pixel in the haystack. When there’s a match, start comparing the sequence of pixels that follow, comparing them across the row. As matching continues to be successful, compare the next row, and the next row, etc. Keep comparing successive rows until matching fails.
To create a visual representation of the “needle” image matching / not matching in the “haystack” image, I wanted to create a new image, copy the “haystack” image into it, and then change that new image to reflect where, if anywhere, the “needle” image matches it.
After I get this working with these two images, I want to be able to run it against a directory with several images to find matches.
I think I’m pretty close to a cool solution here. I wanted to do this with just the standard library, build it from the ground up, and not rely on some third-party package.
If you can help me get this code running, I’ll buy you a beer!
Thank you,
Todd