medianBlur()中值滤波

void medianBlur(InputArray src, OutputArray dst, int kszie);

#include <opencv2/imgproc.hpp>

Blurs an image using the median filter.   使用中值滤波平滑图像

The function smoothes an image using the median filter with the ksize×ksize aperture. Each channel of a multi-channel image is processed independently. In-place operation is supported.

该函数使用ksize×ksize光圈的中值滤波器平滑图像。多通道图像的每个通道都是独立处理的。支持就地操作。

Parameters

src

input 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.

输入1、3、4通道图像。当ksize为3或者5,那么图像深度应该为CV_8U、 CV_16U或者 CV_32F。对于更大的ksize,那图像深度只能为CV_8U。

dst

destination array of the same size and type as src.

与src大小和类型相同的目标数组。

ksize

aperture linear size; it must be odd and greater than 1, for example: 3, 5, 7 ...

孔径线性尺寸;它必须是奇数且大于1,例如:3,5,7…

补充:

图像深度是指每个像素的位数,表示每个像素可以储存的灰度级别数量。在OpenCV中,图像深度可以为CV_8U(8位无符号整数)、CV_16U(16位无符号整数)或CV_32F(32位浮点数)。

CV_8U表示每个像素可以使用8个二进制位来储存灰度级别,即256个灰度级别;CV_16U表示每个像素可以使用16个二进制位来储存灰度级别,即65536个灰度级别;CV_32F表示每个像素可以使用32个二进制位来储存灰度级别,可以储存更精细的灰度级别,但通常对其进行归一化,所以每个像素的值范围通常为 0 到 1。

官网链接:OpenCV: Image Filtering

猜你喜欢

转载自blog.csdn.net/weixin_55696427/article/details/132881647