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 XMLControlprotected booleanprotected static final String[]protected static final intprotected static final intprotected TButtonprotected static final String[]protected booleanprotected JCheckBoxMenuItemprotected booleanprotected JCheckBoxMenuItemprotected static final String[]protected IntegerFieldprotected JLabelprotected JLabelprotected booleanprotected intprotected static final intprotected static final intprotected static final intprotected intprotected JLabelprotected RGBRegion.VertexHandleprotected IntegerFieldprotected JLabelFields 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, ySpinnerFields 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 voidprotected voidClears 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.voiddraw(DrawingPanel panel, Graphics _g) Overrides TTrack draw method.findInteractive(DrawingPanel panel, int xpix, int ypix) Overrides TTrack findInteractive method.intGets the length of the footprints required by this track.String[]static XML.ObjectLoaderReturns an ObjectLoader to save and load data for this class.static doublegetLuma(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.intGets the length of the steps created by this track.protected StringgetTargetDescription(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 voidhideData()Hides the data.booleanGets the autoAdvance property.protected booleanDetermines if any point in this track is autotrackable.booleanGets the fixed position property.booleanGets the fixed shape property.booleanGets the markByDefault property.protected voidprepareVertexHandle(RGBStep step, int i) voidResponds to property change events.protected voidrefreshData(DatasetManager data, TrackerPanel trackerPanel) Refreshes the data.protected voidrefreshStep(RGBStep step) Refreshes a step by setting it equal to a keyframe step.booleanImplements MarkingRequired interface.voidsetFixedPosition(boolean fixed) Sets the fixed position property.voidsetFixedShape(boolean fixed) Sets the fixed shape property.voidsetFontLevel(int level) Sets the font level.voidsetLocked(boolean lock) Locks and unlocks this track.protected voidsetMarking(boolean marking) Sets the marking flag.protected voidsetShapeSize(int n, int width, int height) Sets the shape size of a step and posts an undoable editprotected voidsetShapeType(int type) voidsetTrackerPanel(TrackerPanel panel) Adds events for TrackerPanel.voidsetTrailVisible(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, updateListenerVisibleMethods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
getFormatVariablesin classTTrack
-
getFormatMap
- Specified by:
getFormatMapin classTTrack
-
getFormatDescMap
- Specified by:
getFormatDescMapin classTTrack
-
getBaseType
- Specified by:
getBaseTypein classTTrack
-
getVarDimsImpl
- Specified by:
getVarDimsImplin 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:
setFixedPositionin classTTrack- Parameters:
fixed-trueto fix the position
-
isFixedPosition
public boolean isFixedPosition()Gets the fixed position property.- Returns:
trueif image position is fixed
-
getTargetDescription
Description copied from class:TTrackReturns a description of a target point with a given index.- Overrides:
getTargetDescriptionin 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-trueto fix the shape
-
isFixedShape
public boolean isFixedShape()Gets the fixed shape property.- Returns:
trueif 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:
findInteractivein interfaceInteractive- Overrides:
findInteractivein 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:
setMarkingin classTTrack- Parameters:
marking- true when marking
-
setTrailVisible
public void setTrailVisible(boolean visible) Overrides TTrack setTrailVisible method to keep trails hidden.- Overrides:
setTrailVisiblein classTTrack- Parameters:
visible- ignored
-
setLocked
public void setLocked(boolean lock) Description copied from class:TTrackLocks and unlocks this track. When locked, no changes are allowed. -
isAutoAdvance
public boolean isAutoAdvance()Gets the autoAdvance property. Overrides TTrack method.- Overrides:
isAutoAdvancein classTTrack- Returns:
false
-
isMarkByDefault
public boolean isMarkByDefault()Description copied from class:TTrackGets the markByDefault property. When true, the mouse handler should mark a point whenever the active track reports itself incomplete.- Overrides:
isMarkByDefaultin classTTrack- Returns:
trueif this marks by default
-
requiresMarking
public boolean requiresMarking()Implements MarkingRequired interface.- Specified by:
requiresMarkingin interfaceMarkingRequired
-
createStep
Creates a new step or moves/extends an existing one.- Specified by:
createStepin 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:
deleteStepin classTTrack- Parameters:
n- the frame number- Returns:
- null since step itself is not deleted
-
getStep
Description copied from class:TTrackGets 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:
getStepLengthin classTTrack- Returns:
- the footprint length
-
autoMarkAt
Used by autoTracker to mark a step at a match target position.- Overrides:
autoMarkAtin 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:
isAutoTrackablein classTTrack- Returns:
- true if autotrackable
-
getFootprintLength
public int getFootprintLength()Gets the length of the footprints required by this track.- Specified by:
getFootprintLengthin classTTrack- Returns:
- the footprint length
-
clearData
protected void clearData()Clears the data. -
hideData
protected void hideData()Hides the data. -
refreshData
Refreshes the data.- Overrides:
refreshDatain classTTrack- Parameters:
data- the DatasetManagertrackerPanel- the tracker panel
-
getMenu
Overrides TTrack getMenu method. -
getToolbarTrackComponents
Overrides TTrack getToolbarTrackComponents method.- Overrides:
getToolbarTrackComponentsin classTTrack- Parameters:
trackerPanel- the tracker panel- Returns:
- a list of components
-
getToolbarPointComponents
Overrides TTrack getToolbarPointComponents method.- Overrides:
getToolbarPointComponentsin classTTrack- Parameters:
trackerPanel- the tracker panelpoint- the TPoint- Returns:
- a list of components
-
setFontLevel
public void setFontLevel(int level) Description copied from class:TTrackSets the font level.- Overrides:
setFontLevelin classTTrack- Parameters:
level- the desired font level
-
setTrackerPanel
Adds events for TrackerPanel.- Overrides:
setTrackerPanelin classTTrack- Parameters:
panel- the new TrackerPanel
-
propertyChange
Responds to property change events. This listens for the following events: "stepnumber" & "image" from TrackerPanel.- Specified by:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classTTrack- Parameters:
e- the property change event
-
toString
Overrides Object toString method. -
getNumberFields
Description copied from class:TTrackGets a map of number fields by name.- Overrides:
getNumberFieldsin 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
-