5

python图像处理(sobel算子)

 1 year ago
source link: https://blog.csdn.net/feixiaoxing/article/details/128782674
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

python图像处理(sobel算子)_嵌入式-老费的博客-CSDN博客

【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing @163.com】

        sobel算子和prewitt算子差不多,所以大家可以把这两个算子一起进行学习,也方便记忆。两者最大的不同就是权重不同。还记得上一章说过,如果需要检测直线的左侧和右侧边缘的话,那么给出的算子是[-1,0,1;-1,0,1;-1,0,1]。这个时候,大家可以试想一下,如果我们修改下中心点两侧像素的权重,是不是就可以构成一个新的算子了。从物理意义上说,这种算子就说明,它更相信同一行左右两侧的像素点差异更大,权重更高。根据这个想法,算子就被改成了[-1,0,1;-2,0,2;-1,0,1]。

        以lena图像为例,经过修改后的算子,处理后的图像变成了这样,

8b9b7090054040f3a6a699844c5959f9.png

1、x轴方向检测

        基本原理和prewitt算子x轴方向检测一样,只是权重发生了改变,代码如下


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK