图像边缘颜色更改

文章目录


处理图片:

图像边缘颜色更改

代码:

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

运行:

图像边缘颜色更改

上一篇:九爷带你了解 nginx HTTP模块配置常用指令


下一篇:深度学习重新定义安全技术,大数据的益处,无人驾驶并不聪明,类脑计算……