PDA

View Full Version : comparison of two pixmap images



sar_van81
18th September 2007, 10:00
hi,

i have an application wherein i need to compare two images and do some action based on the outcome.can anyone say me whether is there any class or built-in function for this ?

thanks in advance,

saravanan.

marcel
18th September 2007, 10:09
No, there isn't.
You can start by comparing their sizes. Next, if they are equal, you have to start comparing them pixel by pixel.

An easier and faster solution is to convert the pixmaps to QImage( if they are QPixmaps) and use QImage::scanLine to retrieve lines from the two images and compare them with memcmp.

jpn
18th September 2007, 10:22
What about QPixmap::cacheKey() and QImage::cacheKey()?

marcel
18th September 2007, 10:25
What if one of the images is too big to be stored in the pixmap cache?

Kees
18th September 2007, 11:13
See: http://doc.trolltech.com/4.3/qimage.html#operator-eq-eq

marcel
18th September 2007, 11:35
He's using Qt 3.

EDIT: oh, that's in Qt 3 too.