0
$\begingroup$

I see a lot of articles and topics about OpenCV and machine learning in regards to identifying general things (like cats, or alphanumeric characters) but I am wondering if something more specific is easier/detailed somewhere.

Basically, if I have a folder of 20 images, how would I identify those images contained with another image? Like for a game, where you have to find all the hidden items in an image but are given a list of the items to find.

To make this even easier, let's just pick one image to find within another and also assume this image to search in won't even change the original image at all (no skewing or rotating), just put it (non-overlapping) somewhere zero or many times. If done correctly, I would imagine the results would be an array of rectangles that contain each instance of the image. Just looking for any assistance in learning how to write a program that can do this, even if its just articles/books regarding the technique. Thank you

$\endgroup$
1
$\begingroup$

Think of images as matrices (2D arrays) of numbers that indicate brightness. If you are looking for an exact match of an image in another, you are looking for comparing 2D integer arrays, which could be done with a double for loop that is done for each possible match location (so it is a 4 deep for loop acutaly).

A more interesting related problem is searching an image with no exact match, but with some kind of similarity instead. For that task you should read into template matching algorithms.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.