自编的Canny边缘检测算子,通过与maltab自带的边缘检测算子进行对比发现我们编写的canny算子的性能几乎和matlab自带的性能一致。该程序注重减少for循环,在速度上具有一定的优势,且附带该论文的pdf。希望能够对大家有所帮助。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7312809 2013-06-12 22:00 CannyA Computational Approach to Edge Detection.pdf
文件 2951 2013-06-16 16:47 CannyBuildEdge.asv
文件 1086 2013-06-16 18:54 CannyBuildEdge.m
文件 4429 2013-06-16 18:34 CannyCannyMain.asv
文件 5273 2013-06-16 19:20 CannyCannyMain.m
文件 750 2013-06-16 19:09 CannyGaussFilter.asv
文件 456 2013-06-16 19:11 CannyGaussFilter.m
文件 66614 2013-06-13 10:14 CannyLena.bmp
目录 0 2013-06-16 19:21 Canny
----------- --------- ---------- ----- ----
7394368 9
function [ OutputData ] = BuildEdge( InputData1InputData2 )
%InputData1 低阈值下的边缘图像 InputData2 高阈值下的边缘图像 OutputData 最终输出的边缘图像
% 我们将于高阈值图像相连接的低阈值图像的像素点进行合并,得到最终的边缘图像
[Height Width] = size(InputData1);
OutputData = InputData2*0.5;
BreakFlag = 0;
while BreakFlag == 0
BreakFlag = 1;
for x = 2:Width-1
for y = 2:Height-1
if OutputData(yx) == 0.5
OutputData(yx) = 1;
IdxTmp = find((InputData2(y-1:y+1x-1:x+1) == 0) & (InputData1(y-1:y+1x-1:x+1) ~= 0) & (OutputData(y-1:y+1x-1:x+1) == 0));
if ~isempty(IdxTmp)
RowTmp1 = rem(IdxTmp-1 3)+1;
ColTmp1 = floor((IdxTmp-1)/3)+1;
RowTmp = y+RowTmp1-2;
ColTmp = x+ColTmp1-2;
Idx = (ColTmp-1)*Height+RowTmp;
OutputData(Idx) = 0.5;
BreakFlag = 0;
end
end
end
end
end
% OutputData = OutputData > 0;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7312809 2013-06-12 22:00 CannyA Computational Approach to Edge Detection.pdf
文件 2951 2013-06-16 16:47 CannyBuildEdge.asv
文件 1086 2013-06-16 18:54 CannyBuildEdge.m
文件 4429 2013-06-16 18:34 CannyCannyMain.asv
文件 5273 2013-06-16 19:20 CannyCannyMain.m
文件 750 2013-06-16 19:09 CannyGaussFilter.asv
文件 456 2013-06-16 19:11 CannyGaussFilter.m
文件 66614 2013-06-13 10:14 CannyLena.bmp
目录 0 2013-06-16 19:21 Canny
----------- --------- ---------- ----- ----
7394368 9
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)