Image: Conversion: Binary
Convert image to binary
1. imgBinary t1:=30 t2:=160 c:=red oimg:=mat(2);
2. imgBinary img:=[Mbook1]Msheet1!Mat(1) oimg:=<new>;
Please refer to the page for additional option switches when accessing the x-function from script
Input
Image
Specifies the image to be manipulated. The default input is the active image.
int
Specifies the lowest intensity to be detected. Possible values range from 0 to 255.
Specifies the highest intensity to be detected. Possible values range from 0 to 255.
Specifies the color channel to process. Option list
Output
Specifies the output image. By default, the output image is the same as the input image.
See the syntax here.
This X-Function converts the input image into a binary image by separating the image pixels using thresholds. You can define the thresholds with the variables, Low and High. Any pixels with intensity lower than the value of the Low variable and any pixels with intensity higher than the value of the High variable will be set to 0, which represents the black color. Other pixels will be set to the white color.
In this example, we use the imgBinary function to convert the input image into a binary one:
The computation uses L_IntensityDetectBitmap() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_IntensityDetectBitmap topic.
LEADTOOLS Main API Help file, Version 14
imgAutoBinary, imgDynamicBinary, imgC2gray