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개)
Matt Fig
2011년 3월 22일
1 개 추천
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
d-va
2011년 3월 22일
Matt Fig
2011년 3월 22일
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.
d-va
2011년 3월 23일
Sean de Wolski
2011년 3월 23일
Yes. But what do you mean by match?!?!?!
Exact copy?
isequal(I1,I2);
close: as Matt suggested or a normalized x-correlation.
Matt Fig
2011년 3월 23일
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.
Sean de Wolski
2011년 3월 23일
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.
>> :)
Matt Fig
2011년 3월 23일
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!
VINAY DEVANIDI REDDY
2017년 3월 28일
0 개 추천
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 "..
카테고리
도움말 센터 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!