主程序:..........[m,n,p]=size(rgb);l_color=lab(:,:,1);a_color=lab(:,:,2);b_color=lab(:,:,3);array=1;l_color2=zeros(1,m*n);a_color2=zeros(1,m*n);b_color2=zeros(1,m*n);for j=1for i=1l_color2(array)=lab(i,j,1);a_color2(array)=lab(i,j,2);b_color2(array)=lab(i,j,3);i=i+1;array=array+1;endj=j+1;endDistance(l_color2,a_color2,b_color2,m*n);调用的子程序Distancefunction value=Distance(l_color,a_color,b_color,n)Distance=zeros(n,n);for i=1:nfor j=1:nif i~=jDistance(i,j)=sqrt((l_color(i)-l_color(j))^2+(a_color(i)-a_color(j))^2+(b_color(i)-b_color(j))^2);elseDistance(i,j)=1000;endj=j+1;endi=i+1;end
- 2 回答
- 0 关注
- 144 浏览
添加回答
举报
0/150
提交
取消