ximgproc_niBlackThreshold
import { ximgproc_niBlackThreshold } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
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
dst(x,y) = \fork{\texttt{maxValue}}{if \(src(x,y) > T(x,y)\)}{0}{otherwise}
- THRESH_BINARY_INV
dst(x,y) = \fork{0}{if \(src(x,y) > T(x,y)\)}{\texttt{maxValue}}{otherwise}
where T(x,y) is a threshold calculated individually for each pixel.
The threshold value T(x, y) is determined based on the binarization method chosen. For
classic Niblack, it is the mean minus k times standard deviation of
\texttt{blockSize} \times\texttt{blockSize} neighborhood of (x, y).
The function can't process the image in-place.
See: threshold, adaptiveThreshold
ximgproc_niBlackThreshold(_src: Mat, _dst: Mat, maxValue: number, type_: number, blockSize: number, k: number, binarizationMethod: number, r: number): void;3 available overloads
ximgproc_niBlackThreshold(_src: Mat, _dst: Mat, maxValue: number, type_: number, blockSize: number, k: number): void;ximgproc_niBlackThreshold(_src: Mat, _dst: Mat, maxValue: number, type_: number, blockSize: number, k: number, binarizationMethod: number): void;ximgproc_niBlackThreshold(_src: Mat, _dst: Mat, maxValue: number, type_: number, blockSize: number, k: number, binarizationMethod: number, r: number): void;_srcSource 8-bit single-channel image.
_dstOutput destination, filled by the native operation. Destination image of the same size and the same type as src.
maxValueNon-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.
blockSizeSize of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.
kThe 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.
binarizationMethodBinarization method to use. By default, Niblack's technique is used. Other techniques can be specified, see cv::ximgproc::LocalBinarizationMethods.
rThe user-adjustable parameter used by Sauvola's technique. This is the dynamic range of standard deviation.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.