2.6.1.13 imgLevel(Pro)

Menu Information

Image: Adjustments: Leveling

Brief Information

Adjust image levels

Additional Information

This feature is for OriginPro only.

Command Line Usage

1. imgLevel option:=contrast w:=20 b:=30;

2. imgLevel img:=1 option:=contrast w:=20 b:=30 oimg:=mat(2);

3. imgLevel img:=[Mbook1]Msheet1 oimg:=<new>;

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

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

Input

Image

<active>

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

Level Option option

Input

int

level

Specifies the leveling type.


Option list

  • L:Level
    Perform 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
    Perform leveling on the MASTER channel (the grayscale values of the pixels). No color cast will be introduced.
  • I:Intensity
    Perform leveling on the RGB channel (the sum of the R, G, and B channels). No color cast will be introduced.
WhiteClip(%) w

Input

double

0.5

Specifies the percentage of white pixels to clip from the input image.

BlackClip(%) b

Input

double

0.5

Specifies the percentage of black pixels to clip from the input image.

Output Image oimg

Output

Image

<input>

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

Level Report cl

Output

ReportData

[<new>]<new>!

Specifies the leveling report.


Description

The imgLevel function applies leveling to an image. It makes the dark values darker and the light values lighter. It enhances the contrast and intensity by using the histogram of the image and a color distribution-based algorithm. There are three Leveling types in OriginPro:

  • Level
  • Contrast
  • Intensity

This function allows you to choose the Leveling type, specify the percentage of white pixels and the percentage of black pixels. Choosing Level Report in the Leveling dialog can create a report for this function.

Leveling dialog.png

Another function named imgAutoLevel also can apply leveling to an image, but the percentage of white pixels and black pixels to clip from the input image is set as 5% automatically.

Examples

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

  1. When the input image is active, select Image: Adjustments: Leveling. This opens the dialog of the X-Function.
  2. In the X-Function dialog, change the settings as the screenshot below and click OK to close the dialog.
    ImgLevel help English files image002.jpg
    A new image is created. We can see that the contrast is improved.
ImgLevel help English files image004.jpg
ImgLevel help English files image006.jpg
The original image
The output image


Algorithm

The computation uses L_AutoColorLevelBitmap() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_AutoColorLevelBitmap topic.

References

LEADTOOLS Main API Help file, Version 14

Related X-Functions

imgColorlevel, imgAutoLevel