Package | cc.cote.chromatracker |
Class | public class ChromaTracker |
Inheritance | ChromaTracker Object |
This class is still in beta. Fell free to suggest improvements or corrections on the project's home page.
See also
Property | Defined By | ||
---|---|---|---|
bitmap : Bitmap [read-only]
A Bitmap object of the currently detected pixels to easily visualize
the result
| ChromaTracker | ||
blur : Number A Number between 0 and 1 representing the amount of blur applied | ChromaTracker | ||
brightness : Number A Number between -1 and 1 representing the brightness correction | ChromaTracker | ||
center : Point [read-only]
A Point object representing the center of the detected rectangular
zone
| ChromaTracker | ||
color : uint A uint representing the color set for detection | ChromaTracker | ||
contrast : Number A Number between -1 and 1 representing the contrast correction | ChromaTracker | ||
hue : Number A Number between -1 and 1 representing the hue correction | ChromaTracker | ||
rect : Rectangle [read-only]
A Rectangle object representing the outer rectangular boundary of
detected pixels
| ChromaTracker | ||
saturation : Number A Number between -1 and 1 representing the saturation correction | ChromaTracker | ||
tolerance : Number A Number between 0 and 1 representing the color tolerance | ChromaTracker |
Method | Defined By | ||
---|---|---|---|
ChromaTracker(source:DisplayObject, color:uint = 0x000000, tolerance:Number = 0.2, blur:Number = 0.2, brightness:Number = 0, contrast:Number = 0, saturation:Number = 0, hue:Number = 0)
Creates a ChromaTracker object. | ChromaTracker | ||
track():Rectangle
Executes color detection and returns a rectangle that represents the
outer boundary of detected pixels. | ChromaTracker |
bitmap | property |
bitmap:Bitmap
[read-only] A Bitmap object of the currently detected pixels to easily visualize the result
public function get bitmap():Bitmap
blur | property |
blur:Number
A Number between 0 and 1 representing the amount of blur applied
public function get blur():Number
public function set blur(value:Number):void
brightness | property |
brightness:Number
A Number between -1 and 1 representing the brightness correction
public function get brightness():Number
public function set brightness(value:Number):void
center | property |
center:Point
[read-only] A Point object representing the center of the detected rectangular zone
public function get center():Point
color | property |
color:uint
A uint representing the color set for detection
public function get color():uint
public function set color(value:uint):void
contrast | property |
contrast:Number
A Number between -1 and 1 representing the contrast correction
public function get contrast():Number
public function set contrast(value:Number):void
hue | property |
hue:Number
A Number between -1 and 1 representing the hue correction
public function get hue():Number
public function set hue(value:Number):void
rect | property |
rect:Rectangle
[read-only] A Rectangle object representing the outer rectangular boundary of detected pixels
public function get rect():Rectangle
saturation | property |
saturation:Number
A Number between -1 and 1 representing the saturation correction
public function get saturation():Number
public function set saturation(value:Number):void
tolerance | property |
tolerance:Number
A Number between 0 and 1 representing the color tolerance
public function get tolerance():Number
public function set tolerance(value:Number):void
ChromaTracker | () | Constructor |
public function ChromaTracker(source:DisplayObject, color:uint = 0x000000, tolerance:Number = 0.2, blur:Number = 0.2, brightness:Number = 0, contrast:Number = 0, saturation:Number = 0, hue:Number = 0)
Creates a ChromaTracker object. By default, a small amount (0.2) of tolerance and blur is used. The blur is particularly useful to get rid of stray single pixels. Please note that lighting conditions must be controlled to achieve a reliable detection.
Parameterssource:DisplayObject — DisplayObject upon which to perform color detection
(MovieClip, Video, Bitmap, etc.)
| |
color:uint (default = 0x000000 ) — Color to detect (24bit unsigned int)
| |
tolerance:Number (default = 0.2 ) — Tolerance to apply to the red, green and blue
channels to match a larger range of colors (between 0 and 1)
| |
blur:Number (default = 0.2 ) — Amount of blur to apply (between 0 and 1)
| |
brightness:Number (default = 0 ) — Brightness adjustement (between -1 and 1)
| |
contrast:Number (default = 0 ) — Contrast adjustement (between -1 and 1)
| |
saturation:Number (default = 0 ) — Saturation adjustement (between -1 and 1)
| |
hue:Number (default = 0 ) — Hue adjustement (between -1 and 1)
|
track | () | method |
public function track():Rectangle
Executes color detection and returns a rectangle that represents the outer boundary of detected pixels. This method takes into account color and matrix transformations that may have been applied to the DisplayObject as well as blend modes. The execution of this method also updates the 'bitmap', 'rect' and 'center' properties.
ReturnsRectangle — A Rectangle object representing the rectangular outer boundary
of detected pixels
|