Link to home
Start Free TrialLog in
Avatar of libbysharf
libbysharf

asked on

An algorithm to compare two bitmaps

Hello,
I want to compare two bitmaps (Which are supposed to be similar or almost similar) . I could have done it with a loop that checks the diffrences of every two pixels, but it takes a very long time....
Does anybody knows of an algorithm or an API function that does this?
Thanks,   Libby
Avatar of robert_marquardt
robert_marquardt

Have a look at the help for TBitmap.Scanline
It gives you fast access to a whole line of the bitmap.
ASKER CERTIFIED SOLUTION
Avatar of ginsonic
ginsonic
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Strange thing . I was notified that someone have input an answer here .

Anybody have received same notification ?
Avatar of Manuel Lopez-Michelone
listening...
one method that has worked pretty well for me, if and _ONLY_IF_ both bitmaps are the same size (ie, one is an edited copy of the other), is to simply XOR one bmp over the other & then compress it. The smaller the resulting compressed stream, the more zeros there were in the XOR'ed stream and hence, the more similar the original streams should have been.

GL
Mike
I've written short answer. It looks like some trouble
(Just registered ;( )
I proposed to use GetDIBits to compare arrays in memory
and Intel Image Processing Library for the fastest treatment
i guess, in order to be of more help, we need to know more about the images you're comparing & what you would consider "similar" to mean. Without that all we can do is sugest special case solutions, or hints towards implementations without really touching the problem of a specific algo at all.

GL
Mike
peeking...
Avatar of libbysharf

ASKER

Hello,
Thanks for your answers, I finally managed to do it with the help of this site:
http://www.efg2.com/Lab/ImageProcessing/Scanline.htm
it explains everything about scanline
I'll give the points to ginsonic for the effort :)
Libby