當(dāng)前位置:
首頁(yè) >
matlab 寻找二进制图像边缘
發(fā)布時(shí)間:2025/4/16
66
豆豆
生活随笔
收集整理的這篇文章主要介紹了
matlab 寻找二进制图像边缘
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
I = imread('rice.png');%讀入圖像
BW = im2bw(I, graythresh(I));%轉(zhuǎn)換成2進(jìn)制圖像
[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%整個(gè)循環(huán)表示的是描邊
BW = im2bw(I, graythresh(I));%轉(zhuǎn)換成2進(jìn)制圖像
[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%整個(gè)循環(huán)表示的是描邊
總結(jié)
以上是生活随笔為你收集整理的matlab 寻找二进制图像边缘的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: MATLAB中nargin 的用法
- 下一篇: matlab uicontrol中pop