本文介绍了在Matlab中实现Canny边缘检测算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试在Matlab中实现Canny边缘检测算法.当我在内置的图像cameraman.tif中使用matlab时,它工作正常,但是当我使用不同的图像和命令窗口显示时,它给出了错误:索引超出了矩阵尺寸.
canny_edge错误(第45行)
sum = sum + (ID(u+i, v+j) * filter(i+3, j+3));
整个Matlab代码托管在链接我是Matlab的新手.我尝试实现大学分配算法
解决方案
%figure,imshow(filter);
for u = 3 : r
for v = 3 : c
sum = 0;
for i = -2 : 2
for j = -2 : 2
sum = sum + (ID(u+i, v+j) * filter(i+3, j+3));
end
end
IDx(u,v) = sum;
end
end
i try to implement canny edge detection algorithm in matlab. it work fine when i use matlab in built image cameraman.tif but it give error when i use different image and command window show:
Index exceeds matrix dimensions.
Error in canny_edge (line 45)
sum = sum + (ID(u+i, v+j) * filter(i+3, j+3));
whole matlab code is hosted at linki am novice in matlab. i try to implement algorithm for college assignment
解决方案
%figure,imshow(filter);
for u = 3 : r
for v = 3 : c
sum = 0;
for i = -2 : 2
for j = -2 : 2
sum = sum + (ID(u+i, v+j) * filter(i+3, j+3));
end
end
IDx(u,v) = sum;
end
end
这篇关于在Matlab中实现Canny边缘检测算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!