canny算子边缘检测-Canny.rar
canny算子边缘检测,详细地代码,希望对大家有帮助
function CVHomework1
% r = imread;
% I=rgb2gray;
I = imread;
BW = canny_edge;
figure,imshow
figure,imshow
% Canny边缘检测的函数
% Input:
% a: input image
% sigma: Gaussian的均方差
function e=canny_edge
a = double; % 将图像像素数据转换为double类型
[m,n] = size;
e = repmat),m,n); % 生成初始矩阵
OffGate = 0.0001;
Perc = 0.7;
Th = 0.4;
pw = 1:30; % hardcoding. But it's large enough if sigma isn't too large
sig2 = sigma * sigma; % 方差
width = max/) > OffGate)); % 寻找截断点
t = ;
len = 2*width 1;
t3=[t-0.5;t;t 0.5];
dgau = /)/sig2).'; % 一阶高斯函数的导数
ra = size; % 图像行数
ca = size; % 图像列数
ay = 255*a;
ax = 255*a';
完整见附件
复制代码
2022-02-19 08:59:35
3KB
matlab
1