1

python图像处理(laplacian算子)

 1 year ago
source link: https://blog.csdn.net/feixiaoxing/article/details/128783008
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图像处理(laplacian算子)

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

        和之前的prewitt算子、sobel算子不同,laplacian算子更适合检测一些孤立点、短线段的边缘。因此,它对噪声比较敏感,输入的图像一定要做好噪声的处理工作。同时,laplacian算子设计比较精巧,之前看到的算子都是利用一侧的像素点减去另外一侧的像素点,利用微分数值代替像素值。laplacian算子则不同,它是利用内部的像素点和周围的像素点做微分计算,两者之间的差值赋值给中心点元素作为新的像素值使用。

        以lena图像为例,经过laplacian算子处理后的图像如下所示,

cfcbedc82a2941d4b9506ec2f880582e.png

1、以-4为中心点的算子

        如果中心点的权重为-4,那么正上方、正下方、左侧、右侧的算子则为1。如果写成矩阵的话,应该是[0,1,0;1,-4,1;0,1,0]。整个矩阵之和肯定为0。当然,计算的过程中,结果有可能小于0,或者大于255,这部分都要做好预防。写成代码的话,应该是这个样子的,


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK