Image: Conversion: Threshold
Convert image to black and white using threshold
This feature is for OriginPro only.
1. imgThreshold low:=10 high:=200 channel:=green flt:=min oimg:=<new>;
2. imgThreshold img:=mat(1) low:=10 high:=200 channel:=green flt:=min oimg:=mat(2);
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Input Matrix | img |
Input Image |
|
Specifies the image to be manipulated. The default input is the active image. |
Lower Bound | low |
Input int |
|
Specifies the lower bound of the range, within which the colors will be preserved. |
Upper Bound | high |
Input int |
|
Specifies the upper bound of the range, within which the colors will be preserved. It should be greater than the Lower Bound. |
Channel | channel |
Input int |
|
Specifies the color channel to be manipulated.
|
Reject Value | flt |
Input int |
|
Specifies how to define the new values for the rejected values or values outside the range defined by Lower Bound and Upper Bound.
|
Output Image | oimg |
Output Image |
|
Specifies the output image. By default, the output image is the same as the input image. See the syntax here. |
Color Resolution Conversions tools include Color to B/W (Dynamic Binary), Thresholding, and Gray Colorize. The first two are Pro only.
Thresholding is the simplest method of image segmentation. Before the thresholding, a range that is determined by an upper bound and a lower bound is defined. Then colors of the pixels within this range will be preserved, whereas the colors of other pixels are reset.
The imgThresholding X-Function in OriginPro allows you to define the range which determines the pixel color to change by two variables, Lower Bound and Upper Bound. Additionally, you can specify how to define the new values for the rejected values (values outside the range). You can use this function to apply color adjustment or simple segmentation.
In this example, we use the imgThreshold function to segment the background from the cells in the input image:
Note: OriginPro includes the ability to automatically recalculate the analysis results of the Color Resolution Conversions operation any time you change the parameters or update your source data. In addition, the settings for this analysis routine can be saved to an analysis theme for use later with similar data.
The computation uses L_ColorThresholdBitmap() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_ColorThresholdBitmap topic.
LEADTOOLS Main API Help file, Version 14