1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| v=zeros(size(points1),8);
s=zeros(size(points2),8);
k=1;
%casenumero=zeros(1,size(points2));
for i=1:size(points1)
r1=points1(i,2);
c1=points1(i,3);
v(i,:)=[im1(r1-1,c1-1) im1(r1,c1-1) im1(r1-1,c1+1) im1(r1-1,c1) im1(r1+1,c1) im1(r1+1,c1-1) im1(r1,c1+1) im1(r1+1,c1+1)];
for q=1:8
if v(i,q)<im1(r1,c1)
v(i,q)=0;
else
v(i,q)=1;
end
end
end
for j=1:size(points2)
r2=points2(j,2);
c2=points2(j,3);
s(j,:)=[im2(r2-1,c2-1) im2(r2,c2-1) im2(r2-1,c2+1) im2(r2-1,c2) im2(r2+1,c2) im2(r2+1,c2-1) im2(r2,c2+1) im2(r2+1,c2+1)];
for q=1:8
if s(j,q)<im2(r2,c2)
s(j,q)=0;
else
s(j,q)=1;
end
end
end |
Partager