Image: Adjustments: Histcontrast
Adjust image contrast using histogram
1. imgHistcontrast a:=20;
2. imgHistcontrast a:=-20 img:=mat(1) 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 |
---|---|---|---|---|
Adjustment | a |
Input double |
|
Specifies the amount of contrast change. Valid value range is [-100, +100]. |
Input Matrix | img |
Input Image |
|
Specifies the source image to be manipulated. The default input is the active image. |
Output Image | oimg |
Output Image |
|
Specifies the output image. By default, the output image overwrites the input image. See the syntax here. |
The imgHistcontrast function increases or decreases the contrast of the input image, using a histogram to determine the median brightness.
This function finds the median brightness of the image, then brightens the pixels with values above the median and darkens the pixels with values below the median. This is more sophisticated (but slower) than the imgContrast function, which uses the middle possible value (128) rather than finding the actual median.
In this example, we use the imgHistcontrast function to increase the contrast of the input image with the Adjustment as 20:
This function finds the median brightness of the image, and then brightens the pixels with values above the median and darkens the pixels with values below the median.
The computation uses L_HistoContrastBitmap() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_HistoContrastBitmap topic.
LEADTOOLS Main API Help file, Version 14