aspose file tools*
The moose likes Java in General and the fly likes image comparisons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "image comparisons" Watch "image comparisons" New topic
Author

image comparisons

Paulo Pontes
Greenhorn

Joined: Dec 06, 2004
Posts: 20
Hi!
I have a situation that I need to know if a given image is contained inside a bigger one. I have both images as BufferedImage objects and I really wouldn't like to implement a pixel by pixel comparison

Is there some convenience class that does this for me? I only want to know is image A is inside of picture B and if yes, A is starting ar coord (x,y) of picture A.

Thanks for any help
Paulo
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

I doubt there's anything in the standard API for it, but you can probably find a sourceforge/apache project to help you. Pattern matching in general is not a trivial topic.


My Blog: Down Home Country Coding with Scott Selikoff
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
Strange that this exact question was asked here too.
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

Sounds like a homework problem to me... I can't imagine when it would be useful in practice (where you'd probably want something that looked for approximate sub-images inside of images instead of precise ones).
Jaime M. Tovar
Ranch Hand

Joined: Mar 28, 2005
Posts: 133
Image comparison is used in sign searching and validation. You want to detect if the image you are scanning has an specific anchor. Then you use the anchor to locate the sign some place in the document. Then use fussy algorithms or/and neural networks (maybe others) to know if the sign is the same to a previously scanned sign.

Well as far as I know.


She will remember your heart when men are fairy tales in books written by rabbits.<br /> As long as there is duct tape... there is also hope.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
If the big image contains an exact duplicate of the smaller image, with no rotation, distortion, or changes in color and intensity, then it should be pretty easy to do a pixel-by-pixel comparison, much as Ken described in the other link. If the bytes are not exactly the same though, this becomes much harder, and we'd need a lot more information about what kinds of errors are acceptable.


"I'm not back." - Bill Harding, Twister
Paulo Pontes
Greenhorn

Joined: Dec 06, 2004
Posts: 20
no free lunch for me...

I will code a pixel-by pixel comparison...

this is not for a "serious" project, but not for a homework...

thanks for all
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: image comparisons