Hi,
Am seeking a way to search in a source jpeg image for the top left and bottom right positioning of a cropped and resized sub-image.
For example: source image 3000px wide by 2000px tall. Sub image was cropped from top left 200px,350px to bottom right 1800px, 1900px and resized to be 50% smaller. NB these are all arbitrary figures I've used here, just wanted to illustrate what I'm talking about.
I've searched the site and found details on using the compare method to search for an sub-image within an image, but nothing I found seems to cover dealing with the sub-image being resized. There's a mention on this page http://www.imagemagick.org/Usage/compare/ to using Advanced FFT matching for matching resized sub-images (size independant) which sounds like exactly what I'm after.
If anyone has any pointers they could share I'd appreciate it.
Thanks,
Michael.
Search for cropped and resized image within source image
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Search for cropped and resized image within source image
IM has no way currently that I know using compare or FFT to find a reduced subsection from a larger image (unless you know the reduction factor and then enlarge it first). Both IM compare and IM FFT methods are scale dependent.
Search Google for scale invariant image matching.
See SIFT at http://note.sonots.com/SciSoftware/SIFT.html and in Matlab
and
http://www.eecs.umich.edu/~silvio/teach ... re10_1.pdf
see also
http://www.ece.osu.edu/~zheng/publicati ... TR-IMA.pdf
Search also Fourier-Mellin Transform
Search Google for scale invariant image matching.
See SIFT at http://note.sonots.com/SciSoftware/SIFT.html and in Matlab
and
http://www.eecs.umich.edu/~silvio/teach ... re10_1.pdf
see also
http://www.ece.osu.edu/~zheng/publicati ... TR-IMA.pdf
Search also Fourier-Mellin Transform
Re: Search for cropped and resized image within source image
Thanks fmw42, I thought it am ambitious task so half expected it might not be doable with IM.
Very much appreciate the links you suggested, thanks so much.
Michael.
Very much appreciate the links you suggested, thanks so much.
Michael.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Search for cropped and resized image within source image
This is a problem. and as the papers will show you generally convert both images into a form that is scale and rotation independant. That is the sub-image looks very simular on the transforms image regardless of is size or rotation. Once you know the scale and rotation you can then find its actual position.
Specifically you transform the image into a Polar image with LOG radial scaling.
the polar removes rotation, and the log removes the scaling aspects.
I have not explored the problem practically, only the theory, but I an very interested in what you find and what works for you.
Specifically you transform the image into a Polar image with LOG radial scaling.
the polar removes rotation, and the log removes the scaling aspects.
I have not explored the problem practically, only the theory, but I an very interested in what you find and what works for you.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/