Packagecom.hook.imageprocessing.siox
Classpublic class SegmentationController
InheritanceSegmentationController Inheritance flash.events.EventDispatcher

The SegmentationController is a controller that is designed to help manage the segmentation process. It creates an instance of the SioxSegmentator and contains methods to perform the



Public Properties
 PropertyDefined By
  canvas : ICanvas
Returns the current canvas.
SegmentationController
  confidenceMatrix : Vector.<Number>
A reference to the confidenceMatrix in canvas.
SegmentationController
  cropArea : Rectangle
The area that has been cropped.
SegmentationController
  hasBackground : Boolean
Returns if the current canvas has background or not.
SegmentationController
  hasForeground : Boolean
Returns if the current canvas has foreground or not.
SegmentationController
  imageData : Vector.<Number>
A reference to the imageData in canvas.
SegmentationController
  isSegmentated : Boolean = false
Boolean value of if the current canvas has been segmented or not.
SegmentationController
  refineThreshold : Number = 0.5
This is the sensitivity of the refinement tool.
SegmentationController
  siox : SioxSegmentator
A reference to the SioxSegmentator object that performs the segmentation.
SegmentationController
  smoothing : Number = 2
The smoothing value is used to reduce the amount of jagged egdges in the kutout.
SegmentationController
  stageReference : Stage = null
A reference to the stage
SegmentationController
  undoController : UndoController
UndoController handles all the saving of the states for the canvas.
SegmentationController
Public Methods
 MethodDefined By
  
Initializes the SegmentationController.
SegmentationController
  
applySelection(rect:Rectangle, confidence:Number):void
This method applies cropping.
SegmentationController
  
segmentate():void
Applies segmentation.
SegmentationController
  
setCircleConfidence(center:Point, radius:Number, confidence:Number, feathered:Number = -1, featherDamping:Number = 0.5):void
Sets the confidence of a circular region in the image.
SegmentationController
  
setConfidence(rect:Rectangle, confidence:Number):void
Sets the confidence of a region in the image data.
SegmentationController
  
supPixelRefineAdd(rect:Rectangle, threshold:Number):void
Refines the image by adding back pixels using the SioxSegmentator.subPixelRefineAdd() method.
SegmentationController
  
supPixelRefineAddCircle(center:Point, radius:Number, threshold:Number):void
Refines the image by adding back pixels using the SioxSegmentator.subPixelRefineAddCircle() method.
SegmentationController
  
supPixelRefineRemove(rect:Rectangle, threshold:Number):void
Refines the image by removed pixels using the SioxSegmentator.supPixelRefineRemove() method.
SegmentationController
  
supPixelRefineRemoveCircle(center:Point, radius:Number, threshold:Number):void
Refines the image by removing pixels using the SioxSegmentator.subPixelRefineRemoveCircle() method.
SegmentationController
  
undo():void
If you made a mistake with your brushing, have no fear, this method is here! Calls undo on the UndoController and applies the saved state of the image if it is available.
SegmentationController
Protected Methods
 MethodDefined By
  
When segmentation is complete, dispatch the SegmentationEvent.SEGMENTATION_COMPLETE event.
SegmentationController
Events
 Event Summary Defined By
  Dispatched when the canvas has been swapped with another canvas.SegmentationController
  Dispatched when the canvas has been updated, such as cropping, foreground drawing, background drawing, etc.SegmentationController
  Dispatched when segmentation has completed.SegmentationController
  Dispatched when segmentation has started.SegmentationController
Property Detail
canvasproperty
canvas:ICanvas

Returns the current canvas.


Implementation
    public function get canvas():ICanvas
    public function set canvas(value:ICanvas):void
confidenceMatrixproperty 
public var confidenceMatrix:Vector.<Number>

A reference to the confidenceMatrix in canvas.

cropAreaproperty 
public var cropArea:Rectangle

The area that has been cropped. None of the brushes will brush outside of this area except for the refinement brushes.

hasBackgroundproperty 
hasBackground:Boolean

Returns if the current canvas has background or not.


Implementation
    public function get hasBackground():Boolean
    public function set hasBackground(value:Boolean):void
hasForegroundproperty 
hasForeground:Boolean

Returns if the current canvas has foreground or not.


Implementation
    public function get hasForeground():Boolean
    public function set hasForeground(value:Boolean):void
imageDataproperty 
public var imageData:Vector.<Number>

A reference to the imageData in canvas.

isSegmentatedproperty 
public var isSegmentated:Boolean = false

Boolean value of if the current canvas has been segmented or not.

refineThresholdproperty 
public var refineThreshold:Number = 0.5

This is the sensitivity of the refinement tool.

sioxproperty 
public var siox:SioxSegmentator

A reference to the SioxSegmentator object that performs the segmentation.

smoothingproperty 
public var smoothing:Number = 2

The smoothing value is used to reduce the amount of jagged egdges in the kutout. Higher the number, the more smoothing.

stageReferenceproperty 
public var stageReference:Stage = null

A reference to the stage

undoControllerproperty 
public var undoController:UndoController

UndoController handles all the saving of the states for the canvas.

Constructor Detail
SegmentationController()Constructor
public function SegmentationController(canvas:ICanvas = null)

Initializes the SegmentationController.

Parameters
canvas:ICanvas (default = null) — An optional default canvas to start with.
Method Detail
applySelection()method
public function applySelection(rect:Rectangle, confidence:Number):void

This method applies cropping. It sets everything outside of the rectangle to SegmentationConfidence.CERTAIN_BACKGROUND_CONFIDENCE and everything else to the confidence value provided.

Parameters

rect:Rectangle — The region to apply.
 
confidence:Number — The confidence value to apply inside the rectangle.

segmentate()method 
public function segmentate():void

Applies segmentation. Dispatches the SegmentationEvent.SEGMENTATION_STARTED event.

segmentationCompleteHandler()method 
protected function segmentationCompleteHandler(e:SegmentationEvent):void

When segmentation is complete, dispatch the SegmentationEvent.SEGMENTATION_COMPLETE event.

Parameters

e:SegmentationEvent

setCircleConfidence()method 
public function setCircleConfidence(center:Point, radius:Number, confidence:Number, feathered:Number = -1, featherDamping:Number = 0.5):void

Sets the confidence of a circular region in the image.

Parameters

center:Point — The center point of the circle.
 
radius:Number — The radius of the circle.
 
confidence:Number — The confidence to apply inside that circle.
 
feathered:Number (default = -1) — The feather sensitivity. This value must be between 0 and 1. The closer to 1, the softer the brush. The closer to 0, the harder the brush.
 
featherDamping:Number (default = 0.5) — Reduces overall opacity and strength of the feathering. Between 0 and 1.

setConfidence()method 
public function setConfidence(rect:Rectangle, confidence:Number):void

Sets the confidence of a region in the image data.

Parameters

rect:Rectangle — The region to set.
 
confidence:Number — The confidence to set that region.

supPixelRefineAdd()method 
public function supPixelRefineAdd(rect:Rectangle, threshold:Number):void

Refines the image by adding back pixels using the SioxSegmentator.subPixelRefineAdd() method.

Parameters

rect:Rectangle — The rectangle to apply.
 
threshold:Number — The sensitivity of the refinement. Between 0 and 1.

supPixelRefineAddCircle()method 
public function supPixelRefineAddCircle(center:Point, radius:Number, threshold:Number):void

Refines the image by adding back pixels using the SioxSegmentator.subPixelRefineAddCircle() method.

Parameters

center:Point — The center of the circle region
 
radius:Number — The radius of the circle region.
 
threshold:Number — The sensitivity of the refinement. Between 0 and 1.

supPixelRefineRemove()method 
public function supPixelRefineRemove(rect:Rectangle, threshold:Number):void

Refines the image by removed pixels using the SioxSegmentator.supPixelRefineRemove() method.

Parameters

rect:Rectangle — The rectangle to apply.
 
threshold:Number — The sensitivity of the refinement. Between 0 and 1.

supPixelRefineRemoveCircle()method 
public function supPixelRefineRemoveCircle(center:Point, radius:Number, threshold:Number):void

Refines the image by removing pixels using the SioxSegmentator.subPixelRefineRemoveCircle() method.

Parameters

center:Point — The center of the circle region
 
radius:Number — The radius of the circle region.
 
threshold:Number — The sensitivity of the refinement. Between 0 and 1.

undo()method 
public function undo():void

If you made a mistake with your brushing, have no fear, this method is here! Calls undo on the UndoController and applies the saved state of the image if it is available.

Event Detail
canvasChanged Event
Event Object Type: com.hook.imageprocessing.siox.canvas.CanvasEvent

Dispatched when the canvas has been swapped with another canvas.

canvasManipulated Event  
Event Object Type: com.hook.imageprocessing.siox.canvas.CanvasEvent

Dispatched when the canvas has been updated, such as cropping, foreground drawing, background drawing, etc.

segmentationComplete Event  
Event Object Type: com.hook.imageprocessing.siox.events.SegmentationEvent

Dispatched when segmentation has completed.

segmentationStarted Event  
Event Object Type: com.hook.imageprocessing.siox.events.SegmentationEvent

Dispatched when segmentation has started.