開運算:
- 先腐蝕后膨脹
- 通常用來消除小對象物體,在纖細點處分離物體,平滑較大物體邊界的同時不明顯改變體積
閉運算:
- 先膨脹再腐蝕
- 通常用來填充目標內的細小孔洞,鏈接斷開的鄰接目標,平滑其邊緣的同時不明顯改變其體積
膨脹和腐蝕介紹:https://www.cnblogs.com/asahiLikka/p/11712298.html
f=imread('resource\OpenClose.png'); bw=im2bw(f);%轉換為二值圖 %se=strel('square',5');方形結構元素 se=strel('disk',5');%圓盤形結構元素 imshow(bw);%原圖像 title('開閉運算原始圖像') fo=imopen(bw,se); figure,subplot(221),imshow(fo); title('直接開運算') fc=imclose(bw,se); subplot(222),imshow(fc); title('直接閉運算') foc=imclose(fo,se); subplot(223),imshow(foc); title('先開后閉運算') fco=imopen(fc,se); subplot(224),imshow(fco); title('先閉后開運算')
參考:https://www.cnblogs.com/tornadomeet/archive/2012/03/20/2408086.html