人脸检测-----高斯模糊(7)

高斯模糊

  • 高斯模糊的详细解答

  • 个人理解:高斯模糊简单理解就是讲对应点的坐标值,带入高斯函数中,并将对应的数值写入对应像素点。最后将该像素点进行归一化处理,使得所有像素点的值加起来为1。

  • 代码:

对图像加入 gaussian noise

# add gaussian noise to the image
def gaussian_noise(image):
    h, w, c = image.shape;
    for row in range(0, h, 1):
        for col in range(0, w, 1):
            s = np.random.normal(0, 20, 3);
            b = image[row, col, 0];#blue
            g = image[row, col, 1];
            r = image[row, col, 2];
            image[row, col, 0] = clamp(b + s[0]);
            image[row, col, 1] = clamp(g + s[1]);
            image[row, col, 2] = clamp(r + s[2]);
    cv.imshow(" added gaussian noise", image);

对图像进行Gaussian模糊:

#gaussian 模糊API
dst = cv.GaussianBlur(src, (5, 5), 15);
cv.imshow("gaussian_noise", dst);
  • gaussian模糊的效果:图像的轮廓还在,保留了像素的主要特征,可以消除guassian的影响。
  • opencv的GaussianBlur()API
  • 浮点数运算,比较费时
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值