[][src]Function opencv::imgproc::adaptive_threshold

pub fn adaptive_threshold(
    src: &dyn ToInputArray,
    dst: &mut dyn ToOutputArray,
    max_value: f64,
    adaptive_method: i32,
    threshold_type: i32,
    block_size: i32,
    c: f64
) -> Result<()>

Applies an adaptive threshold to an array.

The function transforms a grayscale image to a binary image according to the formulae:

  • THRESH_BINARY block formula
  • THRESH_BINARY_INV block formula where inline formula is a threshold calculated individually for each pixel (see adaptiveMethod parameter).

The function can process the image in-place.

Parameters

  • src: Source 8-bit single-channel image.
  • dst: Destination image of the same size and the same type as src.
  • maxValue: Non-zero value assigned to the pixels for which the condition is satisfied
  • adaptiveMethod: Adaptive thresholding algorithm to use, see #AdaptiveThresholdTypes. The #BORDER_REPLICATE | #BORDER_ISOLATED is used to process boundaries.
  • thresholdType: Thresholding type that must be either #THRESH_BINARY or #THRESH_BINARY_INV, see #ThresholdTypes.
  • blockSize: Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.
  • C: Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well.

See also

threshold, blur, GaussianBlur