Converts an image to a binary image.
img_out = threshold(img_in, threshold_value, max_value, thresholding_type)
Input image (single channel) (Mat).
Threshold value (double).
Maximum value used with THRESH_BINARY and THRESH_BINARY_INV method. (double).
THRESH_BINARY
THRESH_BINARY_INV
Thresholding type, see below (double).
Output image (Mat).
threshold transforms a (usually grayscale) image into a a binary image, using a specified method:
threshold
scicv_Init(); img = imread(getSampleImage("puffin.png"), CV_LOAD_IMAGE_GRAYSCALE); subplot(1,2,1); matplot(img); [thresh, img_bw] = threshold(img, 125, 255, THRESH_BINARY); subplot(1,2,2); matplot(img_bw); delete_Mat(img); delete_Mat(img_bw);