Click here to Skip to main content
13,456,887 members
Rate this:
Please Sign up or sign in to vote.
See more:

I capture a picture with my webcam, and I need to compare it with other picture captured previously.

I tried to compare the two pictures by pixels, but it didn't return me the desired result; sure this occurs because alternating on brightness and alternating on surrounded light waves.

Please advise me which possible way I could go on to resolve this problem.

Note: I don't have an experience with colors or how to deal with it; just knowing RGB and Hex representation :). So try to support me with references as you could.

Thank you
Posted 13-May-11 10:46am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can make use of Managed GDI+ Methods to perform this task. Take a loot at the following CP article

Comparing Images using GDI+[^]

Here are a few more reference links:

Comparison Method[^]

Image Processing Technique[^]

Comparison Method 2[^]

About Image Comparison :

Every Image has 2 most important and popular quantity. The Root Mean Square ( RMS ) and Signal to Noice Ratio ( SNR ) these are mere pixel ratio comparisons. Which dont really yield you the actual results.

You can make use of some advanced techniques as mentioned by @orc, or there is one more advanced and an entirely different approach to solve the problem. Which makes use of Frequency domain analysis allowing the measurement of minute distortion regardless of Translation.

You might take a look at those algorithms before you start implementing your solutions :)

orc_orc_orc 13-May-11 17:17pm
wow almost identical :) but you answered earlier haha
ZeeroC00l 13-May-11 17:21pm
orc_orc_orc 13-May-11 18:21pm
you deserve a five.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Your question can have so many answers since the topic is comparing two images.
There is no correct answer, and there are many unsolved issues in the comparison of images, and there might be no simple solutions which is suitable for you if what you ask for is simple and limited.

Some thecniques for you to look at;

-Scale Invariant Feature Transform[^]
-Template Matching[^]
-Hough Transform[^]

Some basic code examples;

Image Comparison 1[^]
Comparing Images using GDI+[^]
Image Comparison 2[^]
Moustafa Safwat 13-May-11 17:31pm
First of all Thank you for great respond.
Actually I reviewed quickly the articles you supported me with and it has excellent information, but it seems that all compares to fixed images like charts, and the other has an image compare it with itself after modifying something on it.

I'm sorry I'll get short time from you valued time to describe what I need to do; I capture an image every 30 seconds from my room and every time i capture the image I compare it with an image of my room captured previously.
The problem that the two images are same from my point of view because no changes on the room happens but from my comparer method point of view that they are totally deferent because as i said it has changing in motion.

Anther question what is Hash Values

again thank you and I appreciated your answer
ZeeroC00l 13-May-11 17:48pm
Mere pixel comparison would always act in the way that you mentioned. Since the parameters get changed every other second.

You need look for some algorithm of image comparison that takes into account of Distortion along with translation. If i were you, i would start with Hough Transform..

And Hash value is a unique and compact representation of a piece of data
orc_orc_orc 13-May-11 18:21pm
thanks for answering :)
ZeeroC00l 14-May-11 0:04am
Don't Mention it :) My +5 for those Algorithm links :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02-2016 | 2.8.180322.1 | Last Updated 13 May 2011
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100