|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensourcephysics.cabrillo.tracker.AutoTracker
public class AutoTracker
A class to automatically track a feature of interest in a video. This uses a TemplateMatcher to find a match to the feature in each frame and, if found, marks the active track at the target location.
| Nested Class Summary | |
|---|---|
protected class |
AutoTracker.Corner
A corner point used for resizing. |
protected class |
AutoTracker.FrameData
A class to hold frame data. |
protected class |
AutoTracker.Handle
An edge point used for translation. |
protected class |
AutoTracker.KeyFrame
A class to hold keyframe data. |
protected class |
AutoTracker.Target
A point that defines the target location relative to the mask center. |
protected class |
AutoTracker.Wizard
A wizard to guide users of AutoTracker. |
| Constructor Summary | |
|---|---|
AutoTracker(TrackerPanel panel)
Constructs an AutoTracker for a specified TrackerPanel. |
|
| Method Summary | |
|---|---|
protected void |
addKeyFrame(TPoint p,
double x,
double y)
Adds a key frame for a given track point and mask center position. |
protected void |
buildEvolvedTemplate(AutoTracker.FrameData frame)
Builds an evolved template based on data in the specified FrameData and the current video image. |
protected boolean |
canStep()
|
protected void |
cleanup()
Cleans up resources. |
protected void |
clearSearchPointsDownstream()
Clears search points in frames downstream of the current frame number. |
protected java.awt.image.BufferedImage |
createMagnifiedImage(java.awt.image.BufferedImage source)
|
protected TemplateMatcher |
createTemplateMatcher()
Creates a TemplateMatcher based on the current image and mask. |
protected void |
delete(int n)
Deletes the match data at a specified frame number. |
void |
draw(DrawingPanel panel,
java.awt.Graphics g)
Draws this object. |
protected void |
erase()
Erases the current mark. |
Interactive |
findInteractive(DrawingPanel panel,
int xpix,
int ypix)
Finds the TPoint, if any, located at a specified pixel position. |
TPoint |
findMatchTarget(boolean predict)
Finds the match target, if any. |
protected TPoint |
findMatchTarget(java.awt.Rectangle searchRect)
Finds the target for the best match found within the specified searchRect. |
protected AutoTracker.FrameData |
getFrame(int frameNumber)
|
protected java.util.Map<java.lang.Integer,AutoTracker.FrameData> |
getFrameData()
|
protected java.util.Map<java.lang.Integer,AutoTracker.FrameData> |
getFrameData(int index)
|
protected int |
getIndex(TPoint p)
|
protected java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,AutoTracker.FrameData>> |
getIndexFrameData()
|
protected Mark |
getMark()
Gets the drawing mark. |
protected TPoint |
getMatchCenter(TPoint target)
Returns the center point for a specified match target. |
protected java.awt.Shape |
getMatchShape(TPoint[] pts)
Gets the match shape for the specified center and frame corner positions. |
protected TPoint |
getMatchTarget(TPoint center)
Returns the target for a specified match center point. |
TPoint |
getPredictedMatchTarget(int frameNumber)
Gets the predicted target point in a specified video frame, based on previously marked steps. |
java.awt.Rectangle |
getSearchRect()
Gets the search rectangle. |
protected int |
getStatusCode(int n)
Determines the status code for a given frame. |
TemplateMatcher |
getTemplateMatcher()
Gets the TemplateMatcher. |
protected TTrack |
getTrack()
|
AutoTracker.Wizard |
getWizard()
Gets the wizard. |
double |
getX()
|
double |
getXMax()
Gets the maximum x needed to draw this object. |
double |
getXMin()
Gets the minimum x needed to draw this object. |
double |
getY()
|
double |
getYMax()
Gets the maximum y needed to draw this object. |
double |
getYMin()
Gets the minimum y needed to draw this object. |
protected boolean |
isDrawingKeyFrameFor(TTrack track)
|
boolean |
isEnabled()
|
boolean |
isMeasured()
Determines if information is available to set min/max values. |
boolean |
markCurrentFrame(boolean predictLoc)
Marks a new step in the current frame if a match is found. |
void |
propertyChange(java.beans.PropertyChangeEvent e)
Responds to property change events. |
protected void |
refreshKeyFrame(AutoTracker.KeyFrame keyFrame)
Refreshes the key frame to reflect current center and corner positions. |
void |
refreshSearchRect()
Refreshes the search rectangle based on the current center and corner points. |
protected void |
repaint()
Repaints this object. |
protected void |
reset()
Clears all existing steps and match data for the current point index. |
protected void |
search(boolean startWithThis,
boolean keepGoing)
Starts the search process. |
void |
setEnabled(boolean enabled)
|
protected void |
setSearchPoints(TPoint center,
TPoint corner)
Sets the position of the center and corner of the search rectangle. |
protected void |
setTrack(TTrack aTrack)
Sets the track to mark when matches are found. |
void |
setX(double x)
|
void |
setXY(double x,
double y)
|
void |
setY(double y)
|
protected void |
stop(boolean now,
boolean update)
Stops the search process. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AutoTracker(TrackerPanel panel)
panel - the TrackerPanel| Method Detail |
|---|
protected void setTrack(TTrack aTrack)
aTrack - the track
protected void addKeyFrame(TPoint p,
double x,
double y)
p - the track pointx - the mask center xy - the mask center y
protected void search(boolean startWithThis,
boolean keepGoing)
startWithThis - true to search the current framekeepGoing - true to continue stepping after the first search
protected void stop(boolean now,
boolean update)
public boolean markCurrentFrame(boolean predictLoc)
predictLoc - true to use look-ahead prediction for setting the search loc
public TPoint getPredictedMatchTarget(int frameNumber)
frameNumber - the frame number
public TPoint findMatchTarget(boolean predict)
predict - true to predict the location before searching
public AutoTracker.Wizard getWizard()
public void draw(DrawingPanel panel,
java.awt.Graphics g)
draw in interface Drawablepanel - the drawing panel requesting the drawingg - the graphics context on which to draw
public Interactive findInteractive(DrawingPanel panel,
int xpix,
int ypix)
findInteractive in interface Interactivepanel - the drawing panelxpix - the x pixel positionypix - the y pixel position
public TemplateMatcher getTemplateMatcher()
public java.awt.Rectangle getSearchRect()
public void refreshSearchRect()
protected void setSearchPoints(TPoint center,
TPoint corner)
center - the desired center positioncorner - the desired corner position (may be null)public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange in interface java.beans.PropertyChangeListenere - the property change eventpublic void setEnabled(boolean enabled)
setEnabled in interface Interactivepublic boolean isEnabled()
isEnabled in interface Interactive
public void setXY(double x,
double y)
setXY in interface Interactivepublic void setX(double x)
setX in interface Interactivepublic void setY(double y)
setY in interface Interactivepublic double getX()
getX in interface Interactivepublic double getY()
getY in interface Interactivepublic double getXMin()
Measurable
getXMin in interface Measurablepublic double getXMax()
Measurable
getXMax in interface Measurablepublic double getYMin()
Measurable
getYMin in interface Measurablepublic double getYMax()
Measurable
getYMax in interface Measurablepublic boolean isMeasured()
Measurable
isMeasured in interface Measurableprotected TPoint findMatchTarget(java.awt.Rectangle searchRect)
searchRect - the search rectangle
protected void buildEvolvedTemplate(AutoTracker.FrameData frame)
frame - the FrameData frameprotected TemplateMatcher createTemplateMatcher()
protected java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,AutoTracker.FrameData>> getIndexFrameData()
protected java.util.Map<java.lang.Integer,AutoTracker.FrameData> getFrameData(int index)
protected java.util.Map<java.lang.Integer,AutoTracker.FrameData> getFrameData()
protected AutoTracker.FrameData getFrame(int frameNumber)
protected int getIndex(TPoint p)
protected TTrack getTrack()
protected void erase()
protected void repaint()
protected void cleanup()
protected Mark getMark()
protected TPoint getMatchTarget(TPoint center)
protected TPoint getMatchCenter(TPoint target)
protected void delete(int n)
n - the frame numberprotected void reset()
protected void refreshKeyFrame(AutoTracker.KeyFrame keyFrame)
keyFrame - the KeyFrameprotected java.awt.image.BufferedImage createMagnifiedImage(java.awt.image.BufferedImage source)
protected java.awt.Shape getMatchShape(TPoint[] pts)
pts - TPoint[] {center, frame corner}
protected int getStatusCode(int n)
n - the frame number
protected boolean canStep()
protected boolean isDrawingKeyFrameFor(TTrack track)
protected void clearSearchPointsDownstream()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||