PDA

View Full Version : Calculate hash of an Image?



harshita
21st September 2011, 07:36
hi all,

i am trying to compare 2 images in an efficient manner using Qt/c++, how can i find the hash of an image?

i found this class QCryptographicHash that can be used but i am not sure, if this can be used then how do i convet the image say a Qimage to QByteArray?

Is there any thing similar available in c++?

thank u

stampede
21st September 2011, 09:41
how do i convet the image say a Qimage to QByteArray?
QImage has constBits() (http://doc.qt.nokia.com/latest/qimage.html#constBits) method that returns the pixel data, you can use it to construct the QByteArray (http://doc.qt.nokia.com/stable/qbytearray.html#QByteArray-2), which you can pass to QCrypthographicHash.

Is there any thing similar available in c++?
C++ is a programming language, it has no built-in support for image processing.

mnutt
28th October 2011, 00:06
If you're just comparing images, QImage::cacheKey may be what you're looking for.