# 2.6.1.1 imgAutoLevel

## Menu Information

Image: Adjustments: Auto Level

## Brief Information

Apply auto leveling to image

## Command Line Usage

 

1. imgAutoLevel auto:=intensity; 

2. imgAutoLevel img:=[Mbook1]Msheet1!Mat(1) auto:=contrast oimg:=<new>; 

## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input Matrix img

Input

Image

<active>

Specifies the image to be manipulated and the default input is the active image.

Auto Level auto

Input

int

level

Specifies the leveling method.
Option list

• L:Level
Performs leveling on the individual R, G and B channels, treating each of the R, G and B channels as a individual entity. It introduces color cast on the image.
• C:Contrast
Performs leveling on the MASTER channel (the grayscale values of the pixels). No color cast will be introduced.
• I:Intensity
Performs leveling on the RGB channel (the sum of the R, G, and B channels). No color cast will be introduced.
Output Image oimg

Output

Image

<input>

Specifies the output image. By default, it is the same as the input image. See the syntax here.

Level Report cl

Output

ReportData

<new>

Specifies the leveling report.

## Description

The imgAutoLevel function applies auto-leveling to an image. It makes the dark values darker and the light values lighter. The function automatically enhances shadows and brightens image by 0.5%. It enhances the contrast and intensity by using the histogram of the image and a color distribution-based algorithm.

The imgLevel function can customize the percentage of white pixels and black pixels to clip from the input image to apply leveling to an image.

## Examples

In this example, we use the imgAutoLevel function to increase the contrast of the input image:

When the input image is active, select Image: Adjustments: Auto Level: Contrast. The X-Function is applied and the image is altered. We can see that the contrast has been improved than before.

 The original image The output image

## Algorithm

When auto-leveling is applied, 0.5% of the black pixels and 0.5% of the white pixels in the input image is clipped. The computation uses L_AutoColorLevelBitmap()from LEADTOOLS Main API. For more information, please refer to the LEADTOOLS Main API Help file, Version 14 and read the following topic: L_AutoColorLevelBitmap.

## References

LEADTOOLS Main API Help file, Version 14