adaptivethresholdcv

Applies adaptive threshold to the image, handle.

Syntax

R = distancetransformcv(handle, max, method, type, blocksize, cvalue)

Inputs

handle
Handle of a single channel (grayscale) image or a 2D, real matrix.
Type: integer | mat
max
Non-zero max value applied to the affected pixels of handle.
Type: scalar
method
Adaptive threshold method. Valid values are:
0
Type cv::ADAPTIVE_THRESH_MEAN_C.
1
Type cv::ADAPTIVE_THRESH_GAUSSIAN_C
Type: integer
type
Threshold type. Valid values are:
0
Type cv::THRESH_BINARY.
1
Type cv::THRESH_BINARY_INV
Type: integer
blocksize
Size of pixel neighborhood.
Type: integer
cvalue
Constant subtracted from mean or weighted mean.
Type: scalar

Outputs

R
Handle of the output image.
Type: integer

Example

Apply adaptive threshold on an image:

src = imreadcv('image1.jpg', 0);
m = 100;
method = 1;
ttype = 0;
blocksize = 3;
constantval = 5;
R = adaptivethresholdcv(src, m, method, ttype, blocksize, constantval);