opencv c++ 高斯模糊,高斯双边模糊(28)

高斯模糊

高斯核从最中心到边缘的权值逐渐变小,服从如下正态分布,从而使得中心像素占的比例最大。

 API:

sigmaXGaussian kernel standard deviation in X direction.
sigmaYGaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height, respectively (see getGaussianKernel for details); to fully control the result regardless of possible future modifications of all this semantics, it is recommended to specify all of ksize, sigmaX, and sigmaY.
borderTypepixel extrapolation method, see BorderTypesBORDER_WRAP is not supported.

窗口尺寸设置要求为正数且为奇数,因为偶数无法中心化。

当设置了Size的时候,sigma的设置将无效果。

当窗口尺寸设置为(0,0)时, 模糊效果会达到最佳。

 

 高斯双边模糊

对于空间(x、y)和色彩域内做卷积操作,会考虑色彩空间像素值的差异,只对同一通道内差异大的像素值进行处理。

 API:

int d 设置为0; 

sigmaColor应设置一个较大的值,sigmaSpace为sigmaColor的1/10左右。

代码:

void QuickDemo::gaussian_blur_demo(Mat& image)
{
	Mat dst;
	GaussianBlur(image, dst, Size(0, 0), 15);
	imshow("高斯模糊", dst);
	Mat dst2;
	bilateralFilter(image, dst2, 0, 100, 10);
	imshow("高斯双边模糊", dst2);
}

高斯双边模糊结果:

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值