%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
clc
f=imread('D:\pic\DIP3E_CH10\Fig1016(a)(building_original).tif');
figure,imshow(f);
[gv,t]=edge(f,'sobel','vertical');
figure,imshow(gv);
t
gv=edge(f,'sobel',0.15,'vertical');
figure,imshow(gv);
gboth=edge(f,'sobel',0.15);
figure,imshow(gboth);
w45=[-2 -1 0;-1 0 1;0 1 2]
g45=imfilter(double(f),w45,'replicate');
T=0.3*max(abs(g45(:)));
g45=g45>=T;
figure,imshow(g45);
%%%%%%%%%%%%%%%%%%%%%%%%
%Sobel,LoG 和Canny 边缘检测器的比较
clear all
clc
f=imread('D:\pic\DIP3E_CH10\Fig1016(a)(building_original).tif');
figure,imshow(f);
[g_sobel_default,ts]=edge(f,'sobel');
figure,imshow(g_sobel_default);
[g_log_default,tlog]=edge(f,'log');
figure,imshow(g_log_default);
[g_canny_default,tc]=edge(f,'canny');
figure,imshow(g_canny_default);
[g_sobel_best,ts]=edge(f,'sobel',0.05);
figure,imshow(g_sobel_best);
[g_log_best,tlog]=edge(f,'log',0.003,2.25);
figure,imshow(g_log_best);
[g_canny_best,tc]=edge(f,'canny',[0.04 0.10],1.5);
figure,imshow(g_canny_best);
评论