MATLAB: Identifying objects in a picture containing several objects

identifying objectsImage Processing Toolbox

I have a picture that contains more obiecte.Obiectele I have separated into smaller pictures (cut from full size) must make a sequence of code that I find an object and make a circle around him. 10x

Best Answer

Hello,
Why don't you use command 'normxcorr2' from Matlab??
Here I have a sample code :
clear; clc;
I = imread('office_5.jpg');
J = I(192:250,180:220,:);
imshow(J);
c = normxcorr2(J(:,:,1),I(:,:,1));
[max_c, imax] = max(abs(c(:)));
[ypeak, xpeak] = ind2sub(size(c),imax(1));
corr_offset = [(xpeak-size(J,2)) (ypeak-size(J,1))];
figure, imshow(I); hold on;
rectangle('position',[corr_offset(1) corr_offset(2) 50 50],...
'curvature',[1,1],'edgecolor','g','linewidth',2);
The object is :
And the correlation result is :