matlab 寻找二进制图像边缘
生活随笔
收集整理的這篇文章主要介紹了
matlab 寻找二进制图像边缘
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
I = imread('rice.png');%讀入圖像
BW = im2bw(I, graythresh(I));%轉換成2進制圖像
[B,L] = bwboundaries(BW,'noholes');%尋找邊緣,不包括孔
imshow(label2rgb(L, @jet, [.5 .5 .5]))%顯示圖像,用不同的彩色描述不同 的邊界
hold on
for k = 1:length(B)
? ?boundary = B{k};
? ?plot(boundary(:,2), boundary(:,1), ’w‘‘, ’LineWidth‘, 2)
end%整個循環表示的是描邊
BW = im2bw(I, graythresh(I));%轉換成2進制圖像
[B,L] = bwboundaries(BW,'noholes');%尋找邊緣,不包括孔
imshow(label2rgb(L, @jet, [.5 .5 .5]))%顯示圖像,用不同的彩色描述不同 的邊界
hold on
for k = 1:length(B)
? ?boundary = B{k};
? ?plot(boundary(:,2), boundary(:,1), ’w‘‘, ’LineWidth‘, 2)
end%整個循環表示的是描邊
總結
以上是生活随笔為你收集整理的matlab 寻找二进制图像边缘的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MATLAB中nargin 的用法
- 下一篇: 用界面读取图片并且保存图片的方法