Comparing two images/pictures

I am trying to write a code to compare 2 images/pictures to ensure they match. This is to be used as part as a face recognition system. So i would have to compare the new image that will be taken against a set of images that i have already saved.
Would appreciate some help as im very new to using this system.

2 Comments

What does this question have to do with Matlab? What about searching the literature for suitable measures for comparing images? If you find a measure that fits your needs, come back to this forum and ask for advice on its implementation in Matlab.
Anon
The reason im asking here is because the system source code is to be designed using Matlab.

Sign in to comment.

Answers (2)

Matt Fig
Matt Fig on 22 Mar 2011
You will have to quantify what you mean when you want to know if images match. Do you mean that they should be identical? Or that each pixel should differ by only a small amount?

7 Comments

If the images match(with a certain threshold for error due to lighting or so), i would use the it to trigger the release of a locking mechanism.
Again, what does it mean to "match with a certain threshold?" Does it mean, for example given two images I1 and I2 and threshold thresh:
max(abs(I1(:)-I2(:)))<thresh
This will return true if every value in I1 is within thresh of the same value in I2.
what i meant with to match with a certain threshold :-
let say i have image1,image2 and image3 in my database. A new input image4 is given, the new image will be compared to image1,image2 and image3. If there is a match with the images in the database, image4 is accepted. If not, it is rejected.
Yes. But what do you mean by match?!?!?!
Exact copy?
isequal(I1,I2);
close: as Matt suggested or a normalized x-correlation.
I don't know how to get through to you, d-va. I asked you what you meant by the images matching within a certain threshold. You told me what you would do if the images match. That does not answer the question. You see, MATLAB is a programming language and, as such, its use in solving a problem for you will depend entirely on your ability to specify the problem. Computers are strictly obedient - that is, they do only what you tell them to do, and nothing more. So to get MATLAB to tell you if two images match, you MUST define _exactly_ what you mean by "match within a certain threshold."
You can try if you want to write a program in MATLAB with the line, "If the images match, accept it," but I don't think you will get anywhere.
Matt, that won't work:
%%
if the images match,
accept it
end
??? Undefined function or variable 'the'.
>> the = 2; images = 3; match = 4; accept = 5;it=6;
>> if the images match,
accept it
end
??? Error: "images" was previously used as a variable,
conflicting with its use here as the name of a function or command.
See MATLAB Programming, "How MATLAB Recognizes Function Calls That Use Command Syntax" for
details.
>> :)
I thought that would be the case! Thanks for taking the time to investigate this, Sean de. It was worth a try anyway, you never know just how clever these MathWorkers are getting.
I guess MATLAB does have room for improvement indeed!

Sign in to comment.

VINAY DEVANIDI REDDY
VINAY DEVANIDI REDDY on 28 Mar 2017
hi, this is vinay.
I am doing a project regarding eye detection system . The concept is that eye tracking will be done on a subject1 and the images are compared with one general image of an eye of another subject2 . subject 2 image is constant . When the image matches then it means that the subject is looking at me . When the new image sometime later doesnt match which means that the subject 1 is not looking at me , then the image wont be similar to the subject 2 image . This should trigger a signal to an audio device on subject 1 telling it to " look at me "..

Categories

Asked:

on 22 Mar 2011

Commented:

on 22 Aug 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!