图像处理之平滑处理
来源:互联网 发布:手机制作logo的软件 编辑:程序博客网 时间:2024/05/16 13:55
在Opencv1.0中用于平滑处理的是:
void cvSmooth(const CvArr* src, CvArr* dst, int smoothtype = CV_GAUSSIAN, int param1 = 3, int param2 = 0, int param3 = 0, int param4 = 0);
smoothtype 各种类型是:
1、 CV_BLUR:简单模糊, 在以后高级版本中是:
C++:void blur(InputArraysrc, OutputArray dst, Size ksize, Pointanchor=Point(-1,-1), int borderType=BORDER_DEFAULT);
- src – Source image.
- dst – Destination image of the same size and type as src .
- ksize – Smoothing kernel size.
- anchor – Anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center.
- borderType – Border mode used to extrapolate pixels outside of the image
The function smoothes an image using the kernel:
The call blur(src, dst, ksize, anchor, borderType) is equivalent to boxFilter(src,dst, src.type(), anchor, true, borderType) .
其输出图像的每个像素是输入图像对应像素的简单平均。
2、CV_BLUR_NO_SCALE: 简单无缩放变换的模糊
它与 simple blur本质上是相同的,但并没有计算其平均值的造作, 不支持in place 方式:输入图像与输出图像必须不同(还没看懂)
3、CV_MEDIAN:中值滤波器
C++:void medianBlur(InputArraysrc, OutputArray dst, int ksize);
- src – Source 1-, 3-, or 4-channel image. When ksize is 3 or 5, the image depth should be CV_8U , CV_16U , or CV_32F . For larger aperture sizes, it can only be CV_8U .
- dst – Destination array of the same size and type as src .
- ksize – Aperture linear size. It must be odd and greater than 1, for example: 3, 5, 7 ...
The function smoothes an image using the median filter with the aperture. Each channel of a multi-channel image is processed independently. In-place operation is supported.
中值滤波器将中心像素的正方形邻域内的每个像素值用中间像素值替换。 简单模糊对噪声图像特别是有大的孤立点的图像非常敏感,即使有极少数量点存在较大差异也会导致平均值的明显波动,中值滤波可以选择中间值避免这些点的影响。
4、CV_GAUSSIAN:高斯滤波器
C++: void GaussianBlur(InputArraysrc, OutputArray dst, Size ksize, doublesigmaX, double sigmaY=0, int borderType=BORDER_DEFAULT);
- src – Source image.
- dst – Destination image of the same size and type as src .
- ksize – Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd. Or, they can be zero’s and then they are computed from sigma* .
- sigmaX – Gaussian kernel standard deviation in X direction.
- sigmaY – Gaussian 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 .
- borderType – Pixel extrapolation method. See borderInterpolate() for details.
The function convolves the source image with the specified Gaussian kernel. In-place filtering is supported.
高斯滤波用卷积核与输入图像的每个点进行卷积,将最终计算结果之和作为输出图像的像素值。
5、CV_BILATERAL:双边滤波
C++: void bilateralFilter(InputArray src, OutputArray dst, int d, double sigmaColor, double sigmaSpace, int borderType=BORDER_DEFAULT);
- src – Source 8-bit or floating-point, 1-channel or 3-channel image.
- dst – Destination image of the same size and type as src .
- d – Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, it is computed from sigmaSpace .
- sigmaColor – Filter sigma in the color space. A larger value of the parameter means that farther colors within the pixel neighborhood (see sigmaSpace ) will be mixed together, resulting in larger areas of semi-equal color.
- sigmaSpace – Filter sigma in the coordinate space. A larger value of the parameter means that farther pixels will influence each other as long as their colors are close enough (see sigmaColor ). When d>0 , it specifies the neighborhood size regardless of sigmaSpace . Otherwise, d is proportional to sigmaSpace .
This filter does not work inplace.
Sigma values: For simplicity, you can set the 2 sigma values to be the same. If they are small (< 10), the filter will not have much effect, whereas if they are large (> 150), they will have a very strong effect, making the image look “cartoonish”.
Filter size: Large filters (d > 5) are very slow, so it is recommended to use d=5 for real-time applications, and perhaps d=9 for offline applications that need heavy noise filtering.
进行高斯滤波的通常原因是真是图像在空间内的像素是缓慢变化的,因此临近点的像素变化不会很明显,但是随即的两个订就可能形成很大的像素差,因此高斯滤波在保留信号的条件下减少噪声。但是在接近边缘处就无效了,在那里不希望像素与相邻像素相关,所以高斯滤波会磨平边缘。 而双边滤波能够提供一种不会讲边缘平花掉的方法,代价是需要更多的处理时间。
- 图像处理之平滑处理
- 图像处理之图像平滑
- 图像预处理之平滑处理
- OpenCV之图像平滑处理
- OpenCV图像处理篇之图像平滑
- OpenCv学习笔记之图像平滑处理
- opengles图像处理之平滑过滤
- opengles图像处理之平滑过滤
- 图像平滑处理
- 图像平滑处理
- 图像平滑处理
- 图像平滑处理
- 图像平滑处理
- 【opencv】图像平滑处理
- opencv图像平滑处理
- 图像平滑处理
- 彩色图像平滑处理
- opencv图像平滑处理
- VC++、MFC最好的开源项目
- 编程之美 1.2 中国象棋将帅问题
- 上机项目--计算器的制作
- 算法:排序----直接插入排序(Java)
- 《TCP/IP详解 卷1:协议》学习笔记———TCP:传输控制协议
- 图像处理之平滑处理
- java连接数据库的一个问题
- 什么是WAS和什么事TCL语言
- python中字符串的一些琐碎方法
- NYOJ-199 无线网络覆盖
- c++ 笔记1 类型声明
- android service(一)
- 第一次
- 心跳包机制