Function box_filter

Source
pub fn box_filter(
    src: &impl GMatTraitConst,
    dtype: i32,
    ksize: Size,
    anchor: Point,
    normalize: bool,
    border_type: i32,
    border_value: Scalar,
) -> Result<GMat>
Expand description

Blurs an image using the box filter.

The function smooths an image using the kernel:

block formula

where

block formula

Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on). If you need to compute pixel sums over variable-size windows, use cv::integral.

Supported input matrix data types are [CV_8UC1], [CV_8UC3], [CV_16UC1], [CV_16SC1], [CV_32FC1]. Output image must have the same type, size, and number of channels as the input image.

Note:

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.
  • Function textual ID is “org.opencv.imgproc.filters.boxfilter”

§Parameters

  • src: Source image.
  • dtype: the output image depth (-1 to set the input image data type).
  • ksize: blurring kernel size.
  • anchor: Anchor position within the kernel. The default value inline formula means that the anchor is at the kernel center.
  • normalize: flag, specifying whether the kernel is normalized by its area or not.
  • borderType: Pixel extrapolation method, see cv::BorderTypes
  • borderValue: border value in case of constant border type

§See also

sepFilter, gaussianBlur, medianBlur, integral

§C++ default parameters

  • anchor: Point(-1,-1)
  • normalize: true
  • border_type: BORDER_DEFAULT
  • border_value: Scalar(0)