Ask Your Question

Match cropped image to source image from fixed set?

asked 2018-11-24 22:09:53 -0500

grayshirt gravatar image

updated 2018-12-01 00:11:44 -0500

tl;dr: Given an input image that has been cropped (and possibly enlarged) from an image in a small, known set, I want to find the image from which it has been cropped.

Have a set of ~3K images -- not photos, actually drawn art; of varying sizes; mostly but not always grayscale; often but not always including text. Want to code a solution that takes as input an image that is an arbitrary rectangular crop from one of the images in this set, possibly resized by an unknown factor but otherwise unmodified, and finds the image in the set from which the input was cropped. Set is fixed so can preprocess fingerprints or something if that helps. Don't need any information about the position of the crop or anything like that, just want to identify the source image.

For a non-critical hobby project, so it's OK if it only gets it right ~90% of the time and only looking for a solution that would be practical to run on home hardware like a Raspberry Pi 3 or cheap cloud server. Just looking for an answer along the lines of "hard problem you're not gonna solve" or a point in the direction of the relevant functions. Not even sure OpenCV is what I'm looking for but it was the first thing that came to mind. Thanks!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-12-01 00:09:39 -0500

grayshirt gravatar image

For the sake of anyone coming across this with a similar problem, turns out the tutorial on Feature Matching and Homography was a pretty good start; my task appears to be a case of that. Computing descriptors with BRISK and using those to train a FLANN-based matcher using LSH absolutely nails it. (BRISK seems to be significantly more accurate than ORB, correctly finds even the most difficult query images ORB couldn't match, but is does push my limits of performance and memory usage.)

Thanks to @berak for the the reply he later deleted -- I suspect you noticed my condition that the query images may be enlarged from the original meant template matching wouldn't quite work but that got me looking in the right direction anyway.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-11-24 22:09:53 -0500

Seen: 40 times

Last updated: Dec 01 '18