图像边缘颜色更改

infgrad

关注

阅读 66

2022-06-09


文章目录


处理图片:


图像边缘颜色更改_开发语言

代码:


clear all
clc

BW = imread("Pic_2.bmp");
BW=im2bw(BW);
imshow(BW,[]);

for j=1:size(BW,2)
if sum(BW(:,j))~=sum(BW(:,1))
corner=BW(:,j);
c=j-1;
break
end
end
r=find(corner==0);
r=r(end);

outline = bwtraceboundary(BW,[r c],'W',8,Inf,'counterclockwise');
hold on;
plot(outline(:,2),outline(:,1),'g','LineWidth',2);


[B,L] = bwboundaries(BW);
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'g', 'LineWidth', 2)
end

运行:
图像边缘颜色更改_神经网络_02


精彩评论(0)

0 0 举报