Image: Adjustments: Color Level
Apply user-defined color levels to image
1. imgColorlevel c:=green w:=90 b:=20 g:=80;
2. imgColorlevel c:=red w:=80 b:=20 oimg:=<new>;
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 manipulate. By default, the input image is the active image. |
Channel | c |
Input int |
|
Specifies the color channel to apply color leveling.
|
HiClip(%) | w |
Input double |
|
Specifies the percentage of highlight levels, which will be remapped to max level during color leveling. |
LoClip(%) | b |
Input double |
|
Specifies the percentage of shadow levels, which will be remapped to min level during color leveling. |
Gamma | g |
Input double |
|
Specifies the gamma value used to remap the mid-tone values. |
Output Image | oimg |
Output Image |
|
Specifies the output image. See the syntax here. |
Level Report | cl |
Output ReportData |
|
Specifies the leveling report.
|
The imgColorlevel function applies color leveling to an image, which can alter the highlights, midtones and shadows of a color channel and thus can be used to enhance the color of the image. For example, if the input image has too few highlights in its green channel (you can judge that from the histogram or directly from the input image), you can set the HiClip(%) variable to a number less than 100 to boost the highlights.
In this example, the input image has too few highlights in the green channel. We can tell this from the image view of the input image and the histogram of its green channel. To boost the green highlights, we use the imgColorlevel X-Function.
|
|
Before using the X-function, we first decide a proper HiClip(%) to use. The histogram shows that there are very few pixels whose green levels are not less than 224. So we decide to remap the color levels that are not less than 224 to the max level (255). We compute the value of HiClip(%) as follows:
In other words, we decide to set HiClip(%) to 88.
Then, we can use the imgColorlevel X-Function as follows:
We can see there are more green highlights now.
|
|
The leveling report:
The computation uses L_ColorLevelBitmap() function from LEADTOOLS Main API. For more information, please refer to the LEADTOOLS Main API Help file, Version 14 and read the following topic: L_ColorLevelBitmap.
LEADTOOLS Main API Help file, Version 14