Packagede.popforge.imageprocessing.core
Classpublic final class Histogram

The Histogram class is used to create a histogram of a given image.



Public Properties
 PropertyDefined by
  channels : Array
The histogram values in seperate channels.
Histogram
  DETAIL : int = 4
[static] Histogram detail based on pixel skipping.
Histogram
Public Methods
 MethodDefined by
  
Histogram(image:Image = null)
Creates a Histogram object.
Histogram
  
analyze(image:Image):void
Analyzes the image and updates the histogram.
Histogram
  
Returns a new Histogram object that is a clone of the original instance with an exact copy of the contained information.
Histogram
  
getBitmapData(width:int = 0x100, height:int = 0x100, useMedian:Boolean = false):BitmapData
Creates a BitmapData containing the visual representation of the histogram.
Histogram
  
getCount(from:int, to:int):int
Accumulates the histogram values of all channels in a given interval.
Histogram
  
getValue(index:int):int
Searches for minimum at given position on histogram's x axis.
Histogram
Property detail
channelsproperty
public var channels:Array

The histogram values in seperate channels. Each channel goes from 0x00 to 0xff. A histogram stores the same value of channels as the analyzed image contains.

DETAILproperty 
public static var DETAIL:int = 4

Histogram detail based on pixel skipping. The detail of 1 would result in checking every pixel while the default value of 4 skips 3 pixels in x and y direction.

The default value is 4.

Constructor detail
Histogram()constructor
public function Histogram(image:Image = null)

Creates a Histogram object. If you specify an image, the histogram will be automatically generated.

Parameters
image:Image (default = null) — The image that holds the color information on which the histogram is based.
Method detail
analyze()method
public function analyze(image:Image):void

Analyzes the image and updates the histogram. The histogram should be updated everytime an image has been updated.

Parameters
image:Image — The image that will be analyzed.

See also

clone()method 
public function clone():Histogram

Returns a new Histogram object that is a clone of the original instance with an exact copy of the contained information.

Returns
Histogram — A new Histogram object that is identical to the original.
getBitmapData()method 
public function getBitmapData(width:int = 0x100, height:int = 0x100, useMedian:Boolean = false):BitmapData

Creates a BitmapData containing the visual representation of the histogram.

Parameters
width:int (default = 0x100) — The width of the resulting image in pixels.
 
height:int (default = 0x100) — The height of the resulting image in pixels.
 
useMedian:Boolean (default = false) — Set to true if median should be used to scale the histogram.

Returns
BitmapData — A BitmapData object that stores an image of the histogram.
getCount()method 
public function getCount(from:int, to:int):int

Accumulates the histogram values of all channels in a given interval. The interval will be clamped between 0x00 and 0xff

Parameters
from:int — Value on the histogram's x axis where to start from (0x00 to 0xff).
 
to:int — Value on the histogram's x axis where to end (0x00 to 0xff).

Returns
int — Accumulated value of the histogram in the given interval.

Throws
from parameter is greater than to> parameter.
getValue()method 
public function getValue(index:int):int

Searches for minimum at given position on histogram's x axis.

Parameters
index:int — Position on histogram's x axis.

Returns
int — Minimum at given x position.