PDA

View Full Version : Comparing 2 Images



Bhaji123Go
11-07-2002, 08:04 AM
Hi,

I am trying to compare two image files with same height and width.

I am trying to read the values from the images pixel by pixel and then comparing them using the glReadPixel (...) command.

Does anybody have an idea on how to compare two images to the finest of details?

Is there a better way than glReadPixel(..) to do the same?

Thanks,

Bhaji

Bob
11-07-2002, 08:18 AM
Read the whole image to a buffer and then use either memcmp (for C) or equal (for C++) to compare the data. Check some documentation for info on the tow functions. If you use another language, I can't help.

V-man
11-07-2002, 04:21 PM
A nice way is to use one of the "operations", such as XOR.

Render image 1
SetOpMode(XOR)
Render image 2

but I think for GL it only works in colorindex mode.

Doing a DOT product operation would work also, but then you would have to enter the realm of textures.

I'm sure more can be suggested....

V-man

Relic
11-08-2002, 04:38 AM
>>but I think for GL it only works in colorindex mode.<<

No, glEnable knows GL_COLOR_LOGIC_OP for RGBA and GL_INDEX_LOGIC_OP for color index mode since OpenGL 1.1


[This message has been edited by Relic (edited 11-08-2002).]