边缘检测
-
利用梯度算子进行边缘检测
-
BW =edge( I,type,thresh,direction,‘nothinning’)
-
type: ‘roberts’、‘sobel’、‘prewitt’(算子选择)
-
thresh:敏感度预置参数。灰度低于预置的边缘将不会被检测到。(系统自动设定参数)
-
direction:‘vertical’、‘horizontal’、‘both’
-
‘nothinning’:无细节处理,默认’thinning’
I = imread('C:\Users\Lenovo\Desktop\lena.jpg'); I= rgb2gray(I); BW1 = edge(I,'roberts'); BW2 = edge(I,'sobel'); BW3 = edge(I,'prewitt'); figure subplot(2,2,1),imshow(I),title('orignal') subplot(2,2,2),imshow(BW1),title('roberts') subplot(2,2,3),imshow(BW2),title('sobel') subplot(2,2,4),imshow(BW3),title('prewitt')
-
-
带方向的边缘检测:Robinson算子
-
N=[1,2,1 0,0,0 -1,-2,-1]; edge_n = imfilter(I,N,'symme