Click or drag to resize

CvXImgProcNiblackThreshold Method

Applies Niblack thresholding to input image.

Namespace:  OpenCvSharp.XImgProc
Assembly:  OpenCvSharp (in OpenCvSharp.dll) Version: 1.0.0
Syntax
public static void NiblackThreshold(
	InputArray src,
	OutputArray dst,
	double maxValue,
	ThresholdTypes type,
	int blockSize,
	double k,
	LocalBinarizationMethods binarizationMethod = LocalBinarizationMethods.Niblack
)

Parameters

src
Type: OpenCvSharpInputArray
Source 8-bit single-channel image.
dst
Type: OpenCvSharpOutputArray
Destination image of the same size and the same type as src.
maxValue
Type: SystemDouble
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
Type: OpenCvSharpThresholdTypes
Thresholding type, see cv::ThresholdTypes.
blockSize
Type: SystemInt32
Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.
k
Type: SystemDouble
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 (Optional)
Type: OpenCvSharp.XImgProcLocalBinarizationMethods
Binarization method to use. By default, Niblack's technique is used. Other techniques can be specified, see cv::ximgproc::LocalBinarizationMethods.
Remarks
The function transforms a grayscale image to a binary image according to the formulae: - **THRESH_BINARY** \f[dst(x, y) = \fork{\texttt{maxValue } }{if \(src(x, y) > T(x, y)\)}{0}{otherwise}\f] - ** THRESH_BINARY_INV** \f[dst(x, y) = \fork{0}{if \(src(x, y) > T(x, y)\)}{\texttt{maxValue}}{otherwise}\f] where \f$T(x, y)\f$ is a threshold calculated individually for each pixel. The threshold value \f$T(x, y)\f$ is the mean minus \f$ delta \f$ times standard deviation of \f$\texttt{blockSize} \times\texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$. The function can't process the image in-place.
See Also