[][src]Function opencv::ximgproc::ni_black_threshold

pub fn ni_black_threshold(
    _src: &dyn ToInputArray,
    _dst: &mut dyn ToOutputArray,
    max_value: f64,
    typ: i32,
    block_size: i32,
    k: f64,
    binarization_method: i32,
    r: f64
) -> Result<()>

Performs thresholding on input images using Niblack's technique or some of the popular variations it inspired.

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.

The threshold value inline formula is determined based on the binarization method chosen. For classic Niblack, it is the mean minus inline formula times standard deviation of inline formula neighborhood of inline formula.

The function can't 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, used with the THRESH_BINARY and THRESH_BINARY_INV thresholding types.
  • type: Thresholding type, see cv::ThresholdTypes.
  • blockSize: Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.
  • k: The user-adjustable parameter used by Niblack and inspired techniques. For Niblack, this is normally a value between 0 and 1 that is multiplied with the standard deviation and subtracted from the mean.
  • binarizationMethod: Binarization method to use. By default, Niblack's technique is used. Other techniques can be specified, see cv::ximgproc::LocalBinarizationMethods.
  • r: The user-adjustable parameter used by Sauvola's technique. This is the dynamic range of standard deviation.

See also

threshold, adaptiveThreshold

C++ default parameters

  • binarization_method: BINARIZATION_NIBLACK
  • r: 128