AutoColorLevel method (Main Control)

C++ Builder example

Delphi example

 

Builder Syntax

int AutoColorLevel(LEVELCOLORINFO &Master, LEVELCOLORINFO &Red, LEVELCOLORINFO &Green, LEVELCOLORINFO &Blue, unsigned uBlackClip, unsigned uWhiteClip, unsigned uFlags);

Delphi Syntax

Function AutoColorLevel (var Master: LEVELCOLORINFO; var Red: LEVELCOLORINFO; var Green: LEVELCOLORINFO; var Blue: LEVELCOLORINFO; uBlackClip: L_UINT; uWhiteClip: L_UINT; uFlags: L_UINT): L_INT;

Overview

Refer to Correcting Colors

Remarks

(Raster Pro and above toolkits) Applies one of several types of automatic color leveling to an image.

This method makes the dark values darker and the light values lighter, which automatically enhances shadows and brightens the image. It also maximizes the tonal range of the image. It enhances the contrast and intensity using the image's histogram and a color distribution-based algorithm.

The fields in the records (structures) will be updated with the uMinInput, uMaxInput, uMinOutput, uMaxOutput and uGamma values used by the method for the appropriate channel(s), depending on the flag(s) set in uFlags.

If you set the AUTO_NOPROCESS flag in uFlags, the Master, Red, Green and Blue parameters will be updated with the color leveling information used by the AutoColorLevel method. If you then pass the updated Master, Red, Green and Blue records (structures) to the ColorLevel method, you will obtain the same result that you would have obtained if you had called the AutoColorLevel method with the leveling flag by itself.

If you set only AUTO_NOPROCESS in uFlags then the method will return an error code.

If the image is a grayscale image, then AUTO_LEVEL, AUTO_CONTRAST and AUTO_INTENSITY give identical results. The master, red, green and blue parameters will have the same values.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

If the bitmap has a region, the effect will be applied on the region only.

As an example, the following figure shows an image before any automatic color leveling has been performed:

image\Original.gif

The following figure shows what would happen if you start with the original image and apply the AutoColorLevel method using the AUTO_LEVEL flag.

image\AUTO_LEVEL.gif

The following figure shows what would happen if you start with the original image and apply the AutoColorLevel method using the AUTO_INTENSITY flag.

image\AUTO_INTENSITY.gif

The following figure shows what would happen if you start with the original image and apply the AutoColorLevel method using the AUTO_CONTRAST flag.

image\AUTO_CONTRAST.gif

This method does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this method.

See Also

Elements:

ColorLevel method, Sharpen method, Posterize method, Mosaic method, Emboss method, ShowAverageDlg method, Median method, AddNoise method, IntensityDetect method, SpatialFilter method, MaxFilter method, MinFilter method, Oilify method, Solarize method, WindowLevel method, BinaryFilter method, ColorLevel method, SelectiveColor method.

Topics:

Raster Images: Modifying Intensity Values