Class RGBRegion
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.cabrillo.tracker.TTrack
org.opensourcephysics.cabrillo.tracker.RGBRegion
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,MarkingRequired
,Drawable
,Interactive
,Measurable
,Trackable
A RGBRegion measures RGB properties in a user-defined region of a video image.
- Author:
- Douglas Brown
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
TTrack.NameDialog, TTrack.StepArray, TTrack.TextLineLabel, TTrack.TrackDecimalField, TTrack.TrackNumberField
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected XMLControl
protected boolean
protected static final String[]
protected static final int
protected static final int
protected TButton
protected static final String[]
protected boolean
protected JCheckBoxMenuItem
protected boolean
protected JCheckBoxMenuItem
protected static final String[]
protected IntegerField
protected JLabel
protected JLabel
protected boolean
protected int
protected static final int
protected static final int
protected static final int
protected int
protected JLabel
protected RGBRegion.VertexHandle
protected IntegerField
protected JLabel
Fields inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
angleField, angleLabel, angleSeparator, attachmentNames, attachments, autoAdvance, autoAdvanceItem, autoTrackerMarking, circleFootprintListener, clearStepsItem, closeButton, colorItem, constantsLoadedFromXML, customNumberFormats, dataBuilderItem, dataDescriptions, dataFrames, dataProp, datasetManager, dataValid, defaultColors, defaultFootprint, deleteStepItem, deleteTrackItem, description, descriptionItem, enabled, fieldBorder, fixedItem, footprint, footprintListener, footprintMenu, footprints, formatAngleMouseListener, formatMouseListener, hint, HINT_STEP_ADDED_OR_REMOVED, HINT_STEPS_SELECTED, initialized, isMarking, keyFrames, labelFont, locked, lockedItem, magField, magLabel, magSeparator, markByDefault, markByDefaultItem, name, nameDialog, nameItem, nextID, NOMAP, NOMAPS, NOVARA, NOVARS, numberFields, partName, points, positionFields, preferredColumnOrder, properties, PROPERTY_TTRACK_COLOR, PROPERTY_TTRACK_DATA, PROPERTY_TTRACK_FOOTPRINT, PROPERTY_TTRACK_FORMAT, PROPERTY_TTRACK_LOCKED, PROPERTY_TTRACK_MASS, PROPERTY_TTRACK_MODELEND, PROPERTY_TTRACK_MODELSTART, PROPERTY_TTRACK_NAME, PROPERTY_TTRACK_STEP, PROPERTY_TTRACK_STEPS, PROPERTY_TTRACK_TEXTCOLUMN, PROPERTY_TTRACK_VISIBLE, refreshDataLater, skippedStepWarningCheckbox, skippedStepWarningDialog, skippedStepWarningOn, skippedStepWarningTextpane, stepLabel, steps, stepSeparator, stepSizeWhenFirstMarked, stepValueLabel, targetIndex, textColumnEntries, textColumnNames, tField, tframe, tLabel, toolbarPointComponents, toolbarTrackComponents, tp, trailLength, trailVisible, trailVisibleItem, tSeparator, ttype, tValueLabel, TYPE_CALIBRATION, TYPE_CIRCLEFITTER, TYPE_COORDAXES, TYPE_LINEPROFILE, TYPE_OFFSETORIGIN, TYPE_PERSPECTIVE, TYPE_POINTMASS, TYPE_PROTRACTOR, TYPE_RGBREGION, TYPE_TAPEMEASURE, TYPE_UNKNOWN, TYPE_VECTOR, viewable, visible, visibleItem, xField, xLabel, xSeparator, xSpinner, yField, yLabel, ySeparator, ySpinner
Fields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionautoMarkAt
(int n, double x, double y) Used by autoTracker to mark a step at a match target position.protected void
protected void
Clears the data.createStep
(int n, double x, double y) Creates a new step or moves/extends an existing one.deleteStep
(int n) Overrides TTrack deleteStep method to delete polygon vertices.void
draw
(DrawingPanel panel, Graphics _g) Overrides TTrack draw method.findInteractive
(DrawingPanel panel, int xpix, int ypix) Overrides TTrack findInteractive method.int
Gets the length of the footprints required by this track.String[]
static XML.ObjectLoader
Returns an ObjectLoader to save and load data for this class.static double
getLuma
(double r, double g, double b) Returns the luma (perceived brightness) of a video RGB color.getMenu
(TrackerPanel trackerPanel, JMenu menu0) Overrides TTrack getMenu method.Map<String,
NumberField[]> Gets a map of number fields by name.Gets the shape size.getStep
(int n) Overrides TTrack getStep method to provide fixed behavior.getStep
(TPoint point, TrackerPanel trackerPanel) Gets a step containing a TPoint.int
Gets the length of the steps created by this track.protected String
getTargetDescription
(int pointIndex) Returns a description of a target point with a given index.getToolbarPointComponents
(TrackerPanel trackerPanel, TPoint point) Overrides TTrack getToolbarPointComponents method.getToolbarTrackComponents
(TrackerPanel trackerPanel) Overrides TTrack getToolbarTrackComponents method.getVarDimsImpl
(String variable) protected void
hideData()
Hides the data.boolean
Gets the autoAdvance property.protected boolean
Determines if any point in this track is autotrackable.boolean
Gets the fixed position property.boolean
Gets the fixed shape property.boolean
Gets the markByDefault property.protected void
prepareVertexHandle
(RGBStep step, int i) void
Responds to property change events.protected void
refreshData
(DatasetManager data, TrackerPanel trackerPanel) Refreshes the data.protected void
refreshStep
(RGBStep step) Refreshes a step by setting it equal to a keyframe step.boolean
Implements MarkingRequired interface.void
setFixedPosition
(boolean fixed) Sets the fixed position property.void
setFixedShape
(boolean fixed) Sets the fixed shape property.void
setFontLevel
(int level) Sets the font level.void
setLocked
(boolean lock) Locks and unlocks this track.protected void
setMarking
(boolean marking) Sets the marking flag.protected void
setShapeSize
(int n, int width, int height) Sets the shape size of a step and posts an undoable editprotected void
setShapeType
(int type) void
setTrackerPanel
(TrackerPanel panel) Adds events for TrackerPanel.void
setTrailVisible
(boolean visible) Overrides TTrack setTrailVisible method to keep trails hidden.toString()
Overrides Object toString method.Methods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFixedItem, addFootprint, addListener, addListenerNCF, addPanelEvents, addStepListener, addTextColumn, assembleMenu, clearColumns, convertTextToDataColumn, createAllVariables, createWarningDialog, delete, delete, dispose, erase, erase, finalize, fireStepsChanged, getAllVariables, getAttachmentDescription, getAttachmentLength, getAttachments, getBaseTrackName, getBaseTypeInt, getColor, getCustomFormatPatterns, getData, getData, getDataDescription, getDataName, getDefaultFormatPatterns, getDefaultFormatPatterns, getDescription, getFootprint, getFootprint, getFootprintName, getFootprints, getFootprints, getFormatPatterns, getFrameForData, getIcon, getID, getMarkedPoint, getMarkingCursor, getMenuItems, getMessage, getName, getName, getNameDialog, getNextVisibleStep, getNumberFieldsForStep, getPlotViews, getPreferredDataOrder, getPreviousVisibleStep, getProperty, getPropertyNames, getSkippedStepWarningDialog, getSteps, getStepSizeWarningDialog, getTableViews, getTargetIndex, getTextColumnEntry, getTextColumnNames, getTrack, getTrailLength, getValues, getVarFormatPattern, getVariableDimensions, getVariablesFromFormatterDisplayName, getX, getXMax, getXMin, getY, getYMax, getYMin, initialize, invalidateData, isAttached, isAutoTrackable, isDataValid, isDependent, isEmpty, isEnabled, isFullyAttached, isLocked, isMarking, isMeasured, isStepComplete, isStepVisible, isTrailVisible, isViewable, isVisible, loadAttachmentsFromNames, refreshAttachments, refreshAttachmentsLater, refreshData, refreshDecimalSeparators, remark, remark, removeActiveTrack, removeDeleteTrackItem, removeListener, removeListenerNCF, removePanelEvents, removeStepListener, removeTextColumn, renameTextColumn, repaint, repaint, repaintAll, repaintStep, restorePatterns, savePatterns, setActive, setAnglesInRadians, setAutoAdvance, setColor, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFootprint, setFootprint, setFootprints, setFootprints, setFormatPattern, setInitialFormatPatterns, setMarkByDefault, setName, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, setTextColumnEntry, setTrailLength, setViewable, setVisible, setX, setXY, setY, showAnglePopup, showFormatPopup, updateListenerVisible
Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
-
Field Details
-
defaultEdgeLength
protected static final int defaultEdgeLength- See Also:
-
defaultMaxEdgeLength
protected static final int defaultMaxEdgeLength- See Also:
-
dataVariables
-
fieldVariables
-
formatVariables
-
formatMap
-
formatDescriptionMap
-
SHAPE_ELLIPSE
protected static final int SHAPE_ELLIPSE- See Also:
-
SHAPE_RECTANGLE
protected static final int SHAPE_RECTANGLE- See Also:
-
SHAPE_POLYGON
protected static final int SHAPE_POLYGON- See Also:
-
allVariables
-
fixedPosition
protected boolean fixedPosition -
fixedShape
protected boolean fixedShape -
fixedPositionItem
-
fixedShapeItem
-
widthLabel
-
heightLabel
-
helpLabel
-
editPolygonButton
-
unmarkedLabel
-
maxEdgeLength
protected int maxEdgeLength -
shapeType
protected int shapeType -
shapeTypeDropdown
-
widthField
-
heightField
-
validSteps
-
dataHidden
protected boolean dataHidden -
loading
protected boolean loading -
shapeKeyFrames
-
currentState
-
vertexHandle
-
-
Constructor Details
-
RGBRegion
public RGBRegion()Constructs a RGBRegion.
-
-
Method Details
-
getFormatVariables
- Specified by:
getFormatVariables
in classTTrack
-
getFormatMap
- Specified by:
getFormatMap
in classTTrack
-
getFormatDescMap
- Specified by:
getFormatDescMap
in classTTrack
-
getBaseType
- Specified by:
getBaseType
in classTTrack
-
getVarDimsImpl
- Specified by:
getVarDimsImpl
in classTTrack
-
setFixedPosition
public void setFixedPosition(boolean fixed) Sets the fixed position property. When it is fixed, it is in the same position at all times.- Overrides:
setFixedPosition
in classTTrack
- Parameters:
fixed
-true
to fix the position
-
isFixedPosition
public boolean isFixedPosition()Gets the fixed position property.- Returns:
true
if image position is fixed
-
getTargetDescription
Description copied from class:TTrack
Returns a description of a target point with a given index.- Overrides:
getTargetDescription
in classTTrack
- Parameters:
pointIndex
- the index- Returns:
- the description
-
setShapeType
protected void setShapeType(int type) -
setFixedShape
public void setFixedShape(boolean fixed) Sets the fixed shape property. When fixed, it has the same shape and size at all times.- Parameters:
fixed
-true
to fix the shape
-
isFixedShape
public boolean isFixedShape()Gets the fixed shape property.- Returns:
true
if shape and size are fixed
-
setShapeSize
protected void setShapeSize(int n, int width, int height) Sets the shape size of a step and posts an undoable edit- Parameters:
n
- the frame numberheight
- the desired heightwidth
- the desired width
-
getShapeSize
Gets the shape size.- Returns:
- Dimension width, height
-
draw
Overrides TTrack draw method. -
findInteractive
Overrides TTrack findInteractive method.- Specified by:
findInteractive
in interfaceInteractive
- Overrides:
findInteractive
in classTTrack
- Parameters:
panel
- the drawing panelxpix
- the x pixel position on the panelypix
- the y pixel position on the panel- Returns:
- the first step or motion vector that is hit
-
setMarking
protected void setMarking(boolean marking) Sets the marking flag. Flag should be true when ready to be marked by user.- Overrides:
setMarking
in classTTrack
- Parameters:
marking
- true when marking
-
setTrailVisible
public void setTrailVisible(boolean visible) Overrides TTrack setTrailVisible method to keep trails hidden.- Overrides:
setTrailVisible
in classTTrack
- Parameters:
visible
- ignored
-
setLocked
public void setLocked(boolean lock) Description copied from class:TTrack
Locks and unlocks this track. When locked, no changes are allowed. -
isAutoAdvance
public boolean isAutoAdvance()Gets the autoAdvance property. Overrides TTrack method.- Overrides:
isAutoAdvance
in classTTrack
- Returns:
false
-
isMarkByDefault
public boolean isMarkByDefault()Description copied from class:TTrack
Gets the markByDefault property. When true, the mouse handler should mark a point whenever the active track reports itself incomplete.- Overrides:
isMarkByDefault
in classTTrack
- Returns:
true
if this marks by default
-
requiresMarking
public boolean requiresMarking()Implements MarkingRequired interface.- Specified by:
requiresMarking
in interfaceMarkingRequired
-
createStep
Creates a new step or moves/extends an existing one.- Specified by:
createStep
in classTTrack
- Parameters:
n
- the frame numberx
- the x coordinate in image spacey
- the y coordinate in image space- Returns:
- the step
-
deleteStep
Overrides TTrack deleteStep method to delete polygon vertices.- Overrides:
deleteStep
in classTTrack
- Parameters:
n
- the frame number- Returns:
- null since step itself is not deleted
-
getStep
Description copied from class:TTrack
Gets a step containing a TPoint. May return null. -
getStep
Overrides TTrack getStep method to provide fixed behavior. -
getStepLength
public int getStepLength()Gets the length of the steps created by this track.- Specified by:
getStepLength
in classTTrack
- Returns:
- the footprint length
-
autoMarkAt
Used by autoTracker to mark a step at a match target position.- Overrides:
autoMarkAt
in classTTrack
- Parameters:
n
- the frame numberx
- the x target coordinate in image spacey
- the y target coordinate in image space- Returns:
- the TPoint that was automarked
-
isAutoTrackable
protected boolean isAutoTrackable()Determines if any point in this track is autotrackable.- Overrides:
isAutoTrackable
in classTTrack
- Returns:
- true if autotrackable
-
getFootprintLength
public int getFootprintLength()Gets the length of the footprints required by this track.- Specified by:
getFootprintLength
in classTTrack
- Returns:
- the footprint length
-
clearData
protected void clearData()Clears the data. -
hideData
protected void hideData()Hides the data. -
refreshData
Refreshes the data.- Overrides:
refreshData
in classTTrack
- Parameters:
data
- the DatasetManagertrackerPanel
- the tracker panel
-
getMenu
Overrides TTrack getMenu method. -
getToolbarTrackComponents
Overrides TTrack getToolbarTrackComponents method.- Overrides:
getToolbarTrackComponents
in classTTrack
- Parameters:
trackerPanel
- the tracker panel- Returns:
- a list of components
-
getToolbarPointComponents
Overrides TTrack getToolbarPointComponents method.- Overrides:
getToolbarPointComponents
in classTTrack
- Parameters:
trackerPanel
- the tracker panelpoint
- the TPoint- Returns:
- a list of components
-
setFontLevel
public void setFontLevel(int level) Description copied from class:TTrack
Sets the font level.- Overrides:
setFontLevel
in classTTrack
- Parameters:
level
- the desired font level
-
setTrackerPanel
Adds events for TrackerPanel.- Overrides:
setTrackerPanel
in classTTrack
- Parameters:
panel
- the new TrackerPanel
-
propertyChange
Responds to property change events. This listens for the following events: "stepnumber" & "image" from TrackerPanel.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Overrides:
propertyChange
in classTTrack
- Parameters:
e
- the property change event
-
toString
Overrides Object toString method. -
getNumberFields
Description copied from class:TTrack
Gets a map of number fields by name.- Overrides:
getNumberFields
in classTTrack
- Returns:
- a map of name to NumberField.
-
refreshStep
Refreshes a step by setting it equal to a keyframe step.- Parameters:
step
- the step to refresh
-
prepareVertexHandle
-
checkPolygonEditing
protected void checkPolygonEditing() -
getLuma
public static double getLuma(double r, double g, double b) Returns the luma (perceived brightness) of a video RGB color.- Parameters:
r
- red componentg
- green componentb
- blue component- Returns:
- the video luma
-
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-