Packagede.popforge.imageprocessing.filters.color
Classpublic final class LevelsCorrection
InheritanceLevelsCorrection Inheritance LUTFilter

The LevelsCorrection class is a filter that can stretch or squish the histogram of an image. It is a good idea to use the automatic LevelsCorrection if you pass only the true parameter to the constructor. This is a look-up table based filter.

The implementation of this filter has been derived from gimp-2.3.7 sources (/app/core/drawable-levels.c)

Supported formats:


Example
  
  var filter: LevelsCorrection = new LevelsCorrection( true );
  
  var video: WebCam = new WebCam( 160, 120 );
  var image: Image = new Image( 160, 120, ImageFormat.RGB );
  
  image.loadBitmapData( video.getCurrentFrame(), true );
  
  filter.apply( image );
  



Public Properties
 PropertyDefined by
  automatic : Boolean
Indicates whether the parameters will be set automatically or not.
LevelsCorrection
  from : Array
The start on the histogram's x-axis for every channel (0x00 to 0xff).
LevelsCorrection
  gamma : Array
The gamme value which should be applied for every channel (0.1 to 5).
LevelsCorrection
  to : Array
The end on the histogram's x-axis for every channel (0x00 to 0xff).
LevelsCorrection
Protected Properties
 PropertyDefined by
 Inheritedcache : Boolean
The caching value.
LUTFilter
 Inheritedtables : Array
The look-up tables stored in an array.
LUTFilter
Public Methods
 MethodDefined by
  
LevelsCorrection(automatic:Boolean = true, from:Array = null, gamma:Array = null, to:Array = null)
Creates a new LevelsCorrection object.
LevelsCorrection
  
apply(image:Image):void
Applies the filter to the given Image object.
LevelsCorrection
  
toString():String
Builds and returns a string containing the name of the class.
LevelsCorrection
Protected Methods
 MethodDefined by
 Inherited
buildTables(image:Image):void
This function creates the amount of necessary look-up tables.
LUTFilter
 Inherited
getArray():Array
Creates a new look-up table.
LUTFilter
Property detail
automaticproperty
public var automatic:Boolean

Indicates whether the parameters will be set automatically or not.

fromproperty 
public var from:Array

The start on the histogram's x-axis for every channel (0x00 to 0xff).

gammaproperty 
public var gamma:Array

The gamme value which should be applied for every channel (0.1 to 5).

toproperty 
public var to:Array

The end on the histogram's x-axis for every channel (0x00 to 0xff).

Constructor detail
LevelsCorrection()constructor
public function LevelsCorrection(automatic:Boolean = true, from:Array = null, gamma:Array = null, to:Array = null)

Creates a new LevelsCorrection object. Using automatic levels correction is done by calling new LevelsCorrection( true ).

Parameters
automatic:Boolean (default = true) — Indicates whether the parameters will be set automatically or not.
 
from:Array (default = null) — The start on the histogram's x-axis for every channel (0x00 to 0xff).
 
gamma:Array (default = null) — The end on the histogram's x-axis for every channel (0x00 to 0xff).
 
to:Array (default = null) — The gamme value which should be applied for every channel (0.1 to 5).
Method detail
apply()method
public override function apply(image:Image):void

Applies the filter to the given Image object.

Parameters
image:Image — The image that will be manipulated.
toString()method 
public override function toString():String

Builds and returns a string containing the name of the class.

Returns
String — A string containing the name of the class.