Re: comparing images...

From: Ed Astle (ed.REMOVE_IT.astle_at_thomson.com)
Date: 03/15/04


Date: Mon, 15 Mar 2004 12:49:30 -0000


"David" <david@rrtt.net> wrote in message
news:%23%23qACQfCEHA.684@tk2msftngp13.phx.gbl...
> Hello...
> i've two, 100% identical images in two fales, in fact the only thing what
> differs is their name...
> i've loaded them to two diffrent pictureboxes (C#)...
> is there a way of compering between those two pictureboxes "Image"
property,
> if the picture is same? or any other way to "compare" it, even with the
70%
> of accuracy???
>

Simply subtract one image from the other and you could use the sum of the
differences as a kind of "difference factor".
You could either find the differences between each colour channel or just
take the grayscale view of things, which is simpler.
Assuming you have 2 same sized RGB images the try something like

sum_of_differences = 0
master_sum = 0

for each y // Intensity difference...
    for each x
        RGB master_pixel = master_image[x,y]
        RGB image_pixel = image[x,y]
        int master_intensity = master_pixel.R + master_pixel.G +
master_pixel.B // Add R+G+B
        int image_intensity = image_pixel.R + image_pixel.G + image_pixel.B
// Add R+G+B
        int intensity_difference = master_intensity - image_intensity
// Find difference
        sum_of_differences = sum_of_differences + abs(
intensity_difference )
        master_sum = master_sum + master_intensity

When the code finishes then you possibly (because I haven't even tried this)
have "master_sum" and "sum_of_differences".
As a % it would be 100 * (sum_of_differences / master_sum).

If the images were identical then sum_of_differences = 0, so you get 0%
difference. If "image" was pure black then sum_of_differences should be the
same as master_sum, so you get 100% difference.

It's not much extra work to find the differences of the RGB colour channels
individually - it depends how accurate you want your estimate to be.
Like I said - I haven't tried it but that's how I'd attempt it.

Or just XOR the two images. If they're the same you'll end up with nothing
(all black). There's probably a bitblt type of thing for doing this quickly.

Regards,
Ed



Relevant Pages

  • Re: Fovean Sensors
    ... Sigma's web site is probably not the best place to look for representative examples of what a Sigma camera does, any more than Canon's site is the best place to look for representative examples of a Canon image. ... How come you haven't mentioned Canon having touched up images for display? ... They do it too you know and in fact got "caught out" as you put it doing it to clean up 20D images for display. ... It is a widely know fact that no RGB devise can produce pure black. ...
    (rec.photo.digital)
  • Re: putting text on slideshow?
    ... Windows Movie Maker can be made to use image overlay if the overlay images ... are authored in a specific manner: say: the background is pure black. ... one can use the following custom key transition to overlay these title ...
    (microsoft.public.windowsxp.moviemaker)

Loading