How can I find any different objects between two pictures in matlab

After reading two images (a,b), I want to find any object in "b" image that does not exists in the first image "a" and object could be of any shape does not matter, the two images are pictures captured in the same place with the same state of the camera. But could be some differences, I want to have the number of these different objects.
this what i have tried so far
i = imread('camera1.jpg');
j = imread('camera4.jpg');
a = im2double(i)
b = im2double(j)
f1= ones(3,3)/9;
i1=imfilter(i,a);
j1=imfilter(j,b);
ed1 = edge(i1);
ed2 = edge(j1);
madBlock = mean2(abs(double(ed1) - double(ed2)))

 채택된 답변

Image Analyst
Image Analyst 2015년 11월 12일
Why are you blurring and running an edge detector???? Not necessary. Just subtract, threshold, and threshold above the noise level. Then call bwlabel()
diffImage = abs(a-b);
binaryImage = diffImage > somethreshold;
[labeledImage, numRegions] = bwlabel(binaryImage);
numRegions is the count of the number of regions that are substantially different.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

질문:

2015년 11월 11일

댓글:

2015년 11월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by