Kesty
Kesty

Reputation: 479

Find Coordinates of cropped image (JPG) from it's original

I have a database of original images and for each original images there are various cropped versions.

This is an example of how the image look like:

Original Original Image

Horizontal Crop Horizontal Crop

Square Crop

Square Crop

This is a very simple example, but most images are like this, some might taken a smaller section of the original image than others.

I was looking at OpenCV in python but I'm very new to this kind of image processing.

The idea is to be able to save the cropping information separate from the image to save space and then generate all the cropping and different aspect ratio on the fly with a cache system instead.

Upvotes: 0

Views: 2385

Answers (1)

deets
deets

Reputation: 6395

The method you are looking for is called "template matching". You find examples here

https://docs.opencv.org/trunk/d4/dc6/tutorial_py_template_matching.html

For your problem, given the large images, it might be a good idea to constrain the search space by resizing both images by the same factor. So that searching a position that isn't as precise, but allows then to constrain the actual full pixel sized search to a smaller region around that point.

Upvotes: 4

Related Questions