Packagede.popforge.imageprocessing.geom
Classpublic final class StructuringFunction

The StructuringFunction class is a representation of a matrix used for most morphological filters.



Public Properties
 PropertyDefined by
  halfX : int
[read-only] The x dimension divided by two.
StructuringFunction
  halfY : int
[read-only] The y dimension divided by two.
StructuringFunction
  length : int
[read-only] The length of the structuring function (matrixX * matrixY).
StructuringFunction
  matrix : Array
The matrix array.
StructuringFunction
  matrixX : int
The x dimension of the matrx.
StructuringFunction
  matrixY : int
The y dimension of the matrix.
StructuringFunction
  numValues : int
[read-only] The length of the array that the structuring function will use.
StructuringFunction
Public Methods
 MethodDefined by
  
StructuringFunction(matrix:Array = null)
Creates a new StructuringFunction object.
StructuringFunction
  
getValues(result:Array, channel:BitmapData, x:int, y:int):void
Calculates the results for a given point (x|y).
StructuringFunction
  
toString():String
Builds and returns a string that lists the properties of the StructuringFunction object.
StructuringFunction
Property detail
halfXproperty
halfX:int  [read-only]

The x dimension divided by two.

Implementation
    public function get halfX():int
halfYproperty 
halfY:int  [read-only]

The y dimension divided by two.

Implementation
    public function get halfY():int
lengthproperty 
length:int  [read-only]

The length of the structuring function (matrixX * matrixY).

Implementation
    public function get length():int
matrixproperty 
matrix:Array  [read-write]

The matrix array. This array consists only of the values 0 or 1. It is easier to read instead of writing true and false.

A simple 3x3 structuring function could use this array [ 1, 1, 1, 1, 0, 1, 1, 1, 1 ]. It has the length of 9 and to make it more visible it looks like:

[ 1, 1, 1 ]
[ 1, 0, 1 ]
[ 1, 1, 1 ]

Implementation
    public function get matrix():Array
    public function set matrix(value:Array):void
matrixXproperty 
matrixX:int  [read-write]

The x dimension of the matrx.

Implementation
    public function get matrixX():int
    public function set matrixX(value:int):void
matrixYproperty 
matrixY:int  [read-write]

The y dimension of the matrix.

Implementation
    public function get matrixY():int
    public function set matrixY(value:int):void
numValuesproperty 
numValues:int  [read-only]

The length of the array that the structuring function will use.

Implementation
    public function get numValues():int
Constructor detail
StructuringFunction()constructor
public function StructuringFunction(matrix:Array = null)

Creates a new StructuringFunction object.

The matrix parameter can be passed by directly. In this case the matrix has to be NxN (like 3x3, 7x7, ...). Other properties like matrixX and matrixY will be set automatically. Parameters

matrix:Array (default = null) — The matrix that should be used by the structuring function.
Method detail
getValues()method
public function getValues(result:Array, channel:BitmapData, x:int, y:int):void

Calculates the results for a given point (x|y). The results will be stored in an array that is the first parameter of this function.

Parameters
result:Array — The array this function will write to. Has to be created before.
 
channel:BitmapData — The channel to gather the values from.
 
x:int — The x coordinate of the given point.
 
y:int — The y coordinate of the given point.
toString()method 
public function toString():String

Builds and returns a string that lists the properties of the StructuringFunction object.

Returns
String — A string listing the value of each of the following properties of the StructuringFunction object: matrixX, matrixY, matrix