1. 程式人生 > >Log邊緣檢測演算法

Log邊緣檢測演算法

根據卷積的求導法則,先卷積後求導和先求導後卷積是相等的,所以可以把第1、2步合併為一步,先對高斯濾波器做拉普拉斯變換,得到墨西哥草帽運算元,然後再用這個運算元與影象做卷積。

edge函式實現的語法格式如下:

BW=edge(I, 'log')

BW=edge (I, 'log',thresh)

BW=edge (I, 'log', thresh, sigma)

[BW, thresh]=edge (I, 'log'…)

BW=edge(I, 'log') 自動選擇閾值用LOG運算元進行邊緣檢測。

BW=edge(I,'log',thresh)根據所指定的敏感度閾值thresh,用LOG運算元進行邊緣檢測,它忽略了所有小於閾值的邊緣。當thresh為空時,自動選擇閾值。當指定thresh為0時,輸出影象具有閉合的輪廓,因為其中包含了輸入影象中的所有零交叉點。

<span style="font-family:SimSun;color:#3333ff;">I=rgb2gray(imread('9.jpg'));
subplot(121);imshow(I);title('原圖');
BW=edge(I,'log');
subplot(122);imshow(BW);title('Log邊緣檢測');</span>