资源简介
图像处理中hausdorff距离matlab程序
代码片段和文件信息
i=imread(‘111.bmp‘)
i1=imread(‘222.bmp‘)
save2_filename=‘bg_frame‘;
save2_filename=strcat(save2_filename‘.bmp‘);
[mn]=size(i)
index=1;
for t1=1:m
for t2=1:n
if i(t1t2)>0;
x(index)=t1;
y(index)=t2;
index=index+1;
end
end
end
p=1;
w=zeros(index2);
for t1=1:m;
for t2=1:n;
if i(t1t2)>0;
w(p:)=[t1 t2];
p=p+1;
end
end
end
x1=max(x);
x2=min(x);
y1=max(y);
y2=min(y);
%for k=x2:x1;
% i(ky2)=255;
% i(ky1)=255;
%end
%for k=y2:y1;
% i(x2k)=255;
% i(x1k)=255;
%end
i3=size(x1-x2y1-y2);
for x=x2:x1
for y=y2:y1
if i(xy)>0;
i3(x-x2+1y-y2+1)=255;
end
end
end
subplot(121);
figure(1);
imshow(i3)
imwrite(i3save2_filename‘bmp‘);
%**************************************************************
[mmnn]=size(i1)
index1=1;
for tt1=1:mm
for tt2=1:nn
if i1(tt1tt2)>0;
xx(index1)=tt1;
yy(index1)=tt2;
index1=index1+1;
end
end
end
pp=1;
ww=zeros(index12);
for tt1=1:mm;
for tt2=1:nn;
if i1(tt1tt2)>0;
评论
共有 条评论