代码拉取完成,页面将自动刷新
figure
I=imread('1.jpg'); %иͼ
subplot(1,2,1);
imshow(I);
title('ԭͼ');
m=size(I,1);
n=size(I,2);
r=I(:,:,1);
g=I(:,:,2);
b=I(:,:,3);
r1=reshape(r,m*n,1);
g1=reshape(g,m*n,1);
b1=reshape(b,m*n,1);
[center1,u,obj] = kfcmFun(double(r1),4,150,2);
[center2,u,obj] = kfcmFun(double(g1),4,150,2);
[center3,u,obj] = kfcmFun(double(b1),4,150,2);
img=uint8(zeros(size(I)));
for i=1:m
for j=1:n
distance=abs(center1-double(I(i,j,1)));
k = find(distance == min(distance));
img(i,j,1)=center1(uint8(k(1)));
end
end
for i=1:m
for j=1:n
distance=abs(center2-double(I(i,j,2)));
k = find(distance == min(distance));
img(i,j,2)=center2(uint8(k(1)));
end
end
for i=1:m
for j=1:n
distance=abs(center3-double(I(i,j,3)));
k = find(distance == min(distance));
img(i,j,3)=center3(uint8(k(1)));
end
end
subplot(1,2,2);
imshow(uint8(img));
title('ͼ');
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。