edge_check.m

来自「基于matlab的边缘检测程序」· M 代码 · 共 21 行

M
21
字号
%边缘检测程序
%穆军 2008年10月
%
%

im= imread('olympic.jpg'); % 由文件读取
image(im);  % 显示图片
figure(2);  % create the picture window
bw= double(rgb2gray(im)); % transfer to double
image(bw); %display the picture
figure(3)
gradkernel= [-2 2]; 
dx= abs(conv2(bw, gradkernel, 'same')); %edge is easy to chech after two dimensional convolution
image(dx); %display 

[dx,dy] = gradient(bw); %
gradmag= sqrt(dx.^2 + dy.^2); %get the square root 
image(gradmag); %display the picture edge 
colormap(gray(255)) 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?