Detecting images within another image

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Questioner
Posts: 2
Joined: 2011-05-31T04:21:00-07:00
Authentication code: 8675308

Detecting images within another image

Post by Questioner »

Hi all, I would like to know if there is any way to detect the coordinates of several images inside another (bigger) one.

The actual situation is this:
- I have several JPEG images, all of them with a WHITE background and several little images over that white background
- I would like to obtain the position of the squares which could cover each image. I mean, if one of those little images is a triangle, i would like to obtain the coordinates of the smaller square which could cover entirely that triangle.
- My intention is to locate each little image with something similar to this information: coordinate_X + coordinate_Y + width + height ...or maybe something like this... coordinateA + coordB + coordC + coordD <-- Both cases let me to define the squares I am looking for.

So, the result for 1 big image detection could be something like this:
Detected little image #1: (100,100,50,50) <-- The little image is placed in the position 100, 100 and its size is 50px X 50px
Detected little image #2: (500, 150, 75, 30)
Detected little image #3: (600, 300, 40, 100)

Do you know any way to get what I want to obtain?? Or maybe another new compatible idea !!! I'm open minded and I really don't know how to manage this :P

Thank yo very much!!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Detecting images within another image

Post by fmw42 »

I don't know if these will help but they do similar kinds of things. See my bash unix schell scripts, multicrop and separate at the link below. The virtual-canvase (geometry information) in the verbose info: for each image may contain the bounding box coordinates for that image, but I am not sure without looking more closely.
Questioner
Posts: 2
Joined: 2011-05-31T04:21:00-07:00
Authentication code: 8675308

Re: Detecting images within another image

Post by Questioner »

Thank you very much, fmw42.
I'll put an eye on them in order to discover if I have enogh knowledgements to mix them to get what I need.

Bye! :)
Post Reply