PANDORE Version 6 |
GREYC-IMAGE |
pbinarization
Performs binary thresholding on image and graph.
Synopsis
pbinarization low high [-m mask] [im_in|-] [im_out|-]
Description
pbinarization classifies pixels of the input image im_in
into 2 clusters. Pixels values that are lower than low
or greater than high are set to 0; other values are set to 255:
if im_in[p] ≥ low and im_in[p] ≤ high
then im_out[p]=255;
else im_out[p]=0;
If high is lower than low
then pbinarization performs an inverse thresholding:
if im_in[p] < high or im_in[p] > low
then im_out[p]=255;
else im_out[p]=0;
For multispectral and color images, the threshold
is compared with the min or max pixel value of each band.
For graph, pbinarization operates
on graph nodes.
Parameters
- low and high specify the gray level bounds.
Values are in the gray level domain of the input image
(eg. [0..255] for byte image, [-2147483648..+2147483648]
for long integer image).
If high is lower than low
then pbinarization performs an inverse thresholding.
If high is greater than the maximum
gray level then high is set with the maximum value
(respectively for low).
Inputs
- im_in: an image or a graph.
Outputs
- im_out: an image of bytes (Img2duc, Img3duc) or a graph.
Result
Returns SUCCESS or FAILURE.
Examples
Segments the tangram.pan image in 2 classes, background
and tangram pieces:
pbinarization 100 255 examples/tangram.pan out.pan
Same result with a high bound greater than the maximum value:
pbinarization 100 1e30 examples/tangram.pan out.pan
Same result with a high bound lower than the low bound:
pbinarization 100 -1 examples/tangram.pan out.pan
See also
Thresholding
C++ prototype
Errc PBinarization( const Img2duc &im_in, Img2duc &im_out, float low, float high );
Author: Régis Clouard