org.opensourcephysics.cabrillo.tracker
Class RGBStep

java.lang.Object
  extended by org.opensourcephysics.cabrillo.tracker.Step
      extended by org.opensourcephysics.cabrillo.tracker.RGBStep
All Implemented Interfaces:
java.lang.Cloneable

public class RGBStep
extends Step

This is a step for RGB tracks. It is used for obtaining RGB data in a region of a video image.

Author:
Douglas Brown

Nested Class Summary
protected  class RGBStep.Position
           
 
Field Summary
protected static java.awt.geom.GeneralPath crosshair
           
protected  boolean dataValid
           
protected  java.util.Map<TrackerPanel,java.awt.Shape> hitShapes
           
protected  RGBStep.Position position
           
protected  int radius
           
protected  double[] rgbData
           
protected  RGBRegion rgbRegion
           
 
Fields inherited from class org.opensourcephysics.cabrillo.tracker.Step
dataVisible, defaultIndex, footprint, format, frc, hitRect, marks, n, points, screenPoints, selectionShape, track, transform, valid
 
Constructor Summary
RGBStep(RGBRegion track, int n, double x, double y, int r)
          Constructs a RGBStep with specified coordinates in image space.
 
Method Summary
 java.lang.Object clone()
          Clones this Step.
 void draw(DrawingPanel panel, java.awt.Graphics _g)
          Overrides Step draw method.
 Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
          Overrides Step findInteractive method.
 java.awt.Rectangle getBounds(TrackerPanel trackerPanel)
          Overrides Step getBounds method.
static XML.ObjectLoader getLoader()
          Returns an ObjectLoader to save and load data for this class.
protected  Mark getMark(TrackerPanel trackerPanel)
          Overrides Step getMark method.
 TPoint getPosition()
          Gets the position TPoint.
 double[] getRGBData(TrackerPanel trackerPanel)
          Gets the RGB data.
 void setRadius(int r)
          Sets the radius.
 java.lang.String toString()
          Returns a String describing this step.
 
Methods inherited from class org.opensourcephysics.cabrillo.tracker.Step
erase, erase, getDefaultAutotrackIndex, getDefaultPoint, getFrameNumber, getLength, getPointIndex, getPoints, getTrack, remark, remark, repaint, repaint, setDefaultPointIndex, setFootprint, setHitRectCenter
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

crosshair

protected static java.awt.geom.GeneralPath crosshair

position

protected RGBStep.Position position

rgbRegion

protected RGBRegion rgbRegion

radius

protected int radius

hitShapes

protected java.util.Map<TrackerPanel,java.awt.Shape> hitShapes

rgbData

protected double[] rgbData

dataValid

protected boolean dataValid
Constructor Detail

RGBStep

public RGBStep(RGBRegion track,
               int n,
               double x,
               double y,
               int r)
Constructs a RGBStep with specified coordinates in image space.

Parameters:
track - the track
n - the frame number
x - the x coordinate
y - the y coordinate
r - the radius
Method Detail

getPosition

public TPoint getPosition()
Gets the position TPoint.

Returns:
the position TPoint

findInteractive

public Interactive findInteractive(DrawingPanel panel,
                                   int xpix,
                                   int ypix)
Overrides Step findInteractive method.

Overrides:
findInteractive in class Step
Parameters:
panel - the drawing panel
xpix - the x pixel position
ypix - the y pixel position
Returns:
the TPoint that is hit, or null

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics _g)
Overrides Step draw method.

Overrides:
draw in class Step
Parameters:
panel - the drawing panel requesting the drawing
_g - the graphics context on which to draw

getMark

protected Mark getMark(TrackerPanel trackerPanel)
Overrides Step getMark method.

Overrides:
getMark in class Step
Parameters:
trackerPanel - the tracker panel
Returns:
the mark

getBounds

public java.awt.Rectangle getBounds(TrackerPanel trackerPanel)
Overrides Step getBounds method.

Overrides:
getBounds in class Step
Parameters:
trackerPanel - the tracker panel drawing the step
Returns:
the bounding rectangle

setRadius

public void setRadius(int r)
Sets the radius.

Parameters:
r - the radius

clone

public java.lang.Object clone()
Clones this Step.

Overrides:
clone in class Step
Returns:
a clone of this step

toString

public java.lang.String toString()
Returns a String describing this step.

Overrides:
toString in class Step
Returns:
a descriptive string

getRGBData

public double[] getRGBData(TrackerPanel trackerPanel)
Gets the RGB data. Return array is {R,G,B,luma,pixels}

Parameters:
trackerPanel - the tracker panel
Returns:
an integer array of data values

getLoader

public static XML.ObjectLoader getLoader()
Returns an ObjectLoader to save and load data for this class.

Returns:
the object loader