ptolemy.actor.lib.jmf
Class ColorFinder

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.InstantiableNamedObj
          extended by ptolemy.kernel.Entity
              extended by ptolemy.kernel.ComponentEntity
                  extended by ptolemy.actor.AtomicActor
                      extended by ptolemy.actor.TypedAtomicActor
                          extended by ptolemy.actor.lib.jmf.ColorFinder
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class ColorFinder
extends TypedAtomicActor

An actor that searches for a color in a Buffer.

Since:
Ptolemy II 3.0
Version:
$Id: ColorFinder.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Paul Yang, David Lee, James Yeh
See Also:
Serialized Form
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
 
Field Summary
private  int _frameHeight
           
private  int _frameWidth
           
private  int _histSize
           
private  int _inCount
           
private  int _sumX
           
private  int _sumY
           
private  int[] _uClass
           
private  int _uHigh
           
private  int _uLow
           
private  int[] _vClass
           
private  int _vHigh
           
private  int _vLow
           
private  int[] _yClass
           
private  int _yHigh
           
private  int _yLow
           
 TypedIOPort input
          The port for the input, which has type ObjectToken.
 TypedIOPort outputX
          The output port for the horizontal component, which has type DoubleToken.
 TypedIOPort outputY
          The output port for the vertical component, which has type DoubleToken.
private  byte[] UArray
           
 Parameter uHighValue
          The upper bound on the U range.
 Parameter uLowValue
          The lower bound on the U range.
private  byte[] VArray
           
 Parameter vHighValue
          The upper bound on the V range.
 Parameter vLowValue
          The lower bound on the V range.
private  byte[] YArray
           
 Parameter yHighValue
          The upper bound on the Y range.
 Parameter yLowValue
          The lower bound on the Y range.
 
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
ColorFinder(CompositeEntity container, java.lang.String name)
          Construct an actor with the given container and name.
 
Method Summary
private  int _bts(byte b)
          Convert a byte into an unsigned int
private  int _getUComponent(int point)
          Return the int representing the U band at this pixel
private  int _getUComponent(int x, int y)
          Return the int representing the U band at this pixel
private  int _getVComponent(int point)
          Return the int representing the V band at this pixel
private  int _getVComponent(int x, int y)
          Return the int representing the V band at this pixel
private  int _getYComponent(int point)
          Return the int representing the Y band at this pixel
private  int _getYComponent(int x, int y)
          Return the int representing the Y band at this pixel
 void fire()
          Fire this actor.
 void initialize()
          Initialize this actor.
 
Methods inherited from class ptolemy.actor.TypedAtomicActor
_addPort, _fireAt, _fireAt, attributeTypeChanged, clone, newPort, typeConstraintList, typeConstraints
 
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, addActorFiringListener, addInitializable, clone, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
 
Methods inherited from class ptolemy.kernel.Entity
_description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
 
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
 
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
 
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
 

Field Detail

uHighValue

public Parameter uHighValue
The upper bound on the U range.


uLowValue

public Parameter uLowValue
The lower bound on the U range.


vHighValue

public Parameter vHighValue
The upper bound on the V range.


vLowValue

public Parameter vLowValue
The lower bound on the V range.


yHighValue

public Parameter yHighValue
The upper bound on the Y range.


yLowValue

public Parameter yLowValue
The lower bound on the Y range.


input

public TypedIOPort input
The port for the input, which has type ObjectToken.


outputX

public TypedIOPort outputX
The output port for the horizontal component, which has type DoubleToken.


outputY

public TypedIOPort outputY
The output port for the vertical component, which has type DoubleToken.


_frameWidth

private int _frameWidth

_frameHeight

private int _frameHeight

YArray

private byte[] YArray

UArray

private byte[] UArray

VArray

private byte[] VArray

_histSize

private int _histSize

_inCount

private int _inCount

_sumX

private int _sumX

_sumY

private int _sumY

_yLow

private int _yLow

_yHigh

private int _yHigh

_uLow

private int _uLow

_uHigh

private int _uHigh

_vLow

private int _vLow

_vHigh

private int _vHigh

_yClass

private int[] _yClass

_uClass

private int[] _uClass

_vClass

private int[] _vClass
Constructor Detail

ColorFinder

public ColorFinder(CompositeEntity container,
                   java.lang.String name)
            throws IllegalActionException,
                   NameDuplicationException
Construct an actor with the given container and name.

Parameters:
container - The container.
name - The name of this actor.
Throws:
IllegalActionException - If the actor cannot be contained by the proposed container.
NameDuplicationException - If the container already has an actor with this name.
Method Detail

fire

public void fire()
          throws IllegalActionException
Fire this actor. Output the X and Y coordinates if it finds the color in the Buffer.

Specified by:
fire in interface Executable
Overrides:
fire in class AtomicActor
Throws:
IllegalActionException - If a contained method throws it, or if a token is received that contains a null image.

initialize

public void initialize()
                throws IllegalActionException
Initialize this actor. Set the color to search for in the YUV domain.

Specified by:
initialize in interface Initializable
Overrides:
initialize in class AtomicActor
Throws:
IllegalActionException - If a contained method throws it.

_bts

private int _bts(byte b)
Convert a byte into an unsigned int


_getUComponent

private int _getUComponent(int point)
Return the int representing the U band at this pixel


_getUComponent

private int _getUComponent(int x,
                           int y)
Return the int representing the U band at this pixel


_getVComponent

private int _getVComponent(int point)
Return the int representing the V band at this pixel


_getVComponent

private int _getVComponent(int x,
                           int y)
Return the int representing the V band at this pixel


_getYComponent

private int _getYComponent(int point)
Return the int representing the Y band at this pixel


_getYComponent

private int _getYComponent(int x,
                           int y)
Return the int representing the Y band at this pixel