Matlab图像处理——图像边缘检测方法(算子)

1.edge函数语法

BW = edge(I)
BW = edge(I,method)
BW = edge(I,method,threshold)
BW = edge(I,method,threshold,direction)
BW = edge(___,"nothinning")
BW = edge(I,method,threshold,sigma)
BW = edge(I,method,threshold,h)

BW = edge(I) 返回二值图像 BW,其中的值 1 对应于灰度或二值图像 I 中函数找到边缘的位置,值 0 对应于其他位置。默认情况下,edge 使用 Sobel 边缘检测方法。

BW = edge(I,method) 使用 method 指定的边缘检测算法检测图像 I 中的边缘。

BW = edge(I,method,threshold) 返回强度高于 threshold 的所有边缘。

BW = edge(I,method,threshold,direction) 指定要检测的边缘的方向。Sobel 和 Prewitt 方法可以检测垂直方向和/或水平方向的边缘。Roberts 方法可以检测与水平方向成 45 度角和/或 135 度角的边缘。仅当 method 是 "Sobel"、"Prewitt" 或 "Roberts" 时,此语法才有效。

BW = edge(___,"nothinning") 跳过边缘细化阶段,这可以提高性能。仅当 method 是 "Sobel"、"Prewitt" 或 "Roberts" 时,此语法才有效。

BW = edge(I,method,threshold,sigma) 指定 sigma,即滤波器的标准差。仅当 method 是 "log" 或 "Canny" 时,此语法才有效。

BW = edge(I,method,threshold,h) 使用 "zerocross" 方法和您指定的滤波器 h 检测边缘。仅当 method 是 "zerocross" 时,此语法才有效。

2.使用示例
clear
clc
I=imread('1.jpg');%读入图像
I=rgb2gray(I); %转换为灰度图像
I=im2double(I);
[J1,thresh]=edge(I,'Roberts',[],'both');
[J2,thresh]=edge(I,'Roberts',[],'horizontal');
[J3,thresh]=edge(I,'Roberts',[],'vertical');
subplot(221);imshow(I);title('原始图像');
subplot(222);imshow(J1);title('Roberts算子,水平和垂直方向');
subplot(223);imshow(J2);title('Roberts算子,水平方向');
subplot(224);imshow(J3);title('Roberts算子,垂直方向');

 

最后:

如果你想要进一步了解更多的相关知识,可以关注下面公众号联系~会不定期发布相关设计内容包括但不限于如下内容:信号处理、通信仿真、算法设计、matlab appdesigner,gui设计、simulink仿真......希望能帮到你!

5a8015ddde1e41418a38e958eb12ecbd.png

 

  • 8
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MatpyMaster

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值