Package org.opensourcephysics.media.core
Class PerspectiveFilter
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.media.core.Filter
org.opensourcephysics.media.core.PerspectiveFilter
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
This is a Filter that corrects perspective in the source image.
- Version:
- 1.0
- Author:
- Douglas Brown
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.opensourcephysics.media.core.Filter
Filter.InspectorDlg
-
Field Summary
FieldsFields inherited from class org.opensourcephysics.media.core.Filter
ableButton, autoScale720x480, changed, clearButton, closeButton, copyItem, deleteItem, doCreateOutput, enabledAction, enabledItem, frame, h, hasInspector, haveGUI, heightFactor, input, inspectorDlg, inspectorVisible, inspectorX, inspectorY, nPixelsIn, output, pixelsIn, pixelsOut, previousState, propertiesItem, PROPERTY_FILTER_BRIGHTNESS, PROPERTY_FILTER_COLOR, PROPERTY_FILTER_ENABLED, PROPERTY_FILTER_FILTER, PROPERTY_FILTER_IMAGE, PROPERTY_FILTER_MEAN, PROPERTY_FILTER_RESET, PROPERTY_FILTER_TAB, PROPERTY_FILTER_VISIBLE, ROTATE_180, ROTATE_CCW_90, ROTATE_CW_90, ROTATE_NONE, rotationType, source, stack, vidPanel, w, widthFactor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteKeyFrame
(int frameNumber, PerspectiveFilter.Corner corner) Deletes the key frame associated with a corner.void
dispose()
Disposes of this filter.getColor()
Gets the color.getCorner
(int index) Gets the corner associated with an index.int
Gets the index associated with a corner point.static XML.ObjectLoader
Returns an XML.ObjectLoader to save and load filter data.boolean
Determines if the inspector has been instantiated.protected void
Creates the input and output images and ColorConvertOp.protected Filter.InspectorDlg
boolean
isActive()
Determines if the inspector is active.boolean
Gets whether this filter is enabled.boolean
isFixed
(boolean in) Gets the fixed position behavior.boolean
Determines if the inspector tab is the input tab.boolean
Gets whether the super-class of this filter is enabled.protected Filter.InspectorDlg
void
void
refresh()
Refreshes this filter's GUIvoid
setCornerLocation
(int frameNumber, int cornerIndex, double x, double y) Sets the location of a corner.void
setFixed
(boolean fix, boolean in) Sets the fixed position behavior (all frames identical).void
setInputEnabled
(boolean enable) Sets the inspector tab to input or output.protected void
Sets the output image pixels to a rotated version of the input pixels.void
setVideoPanel
(VideoPanel panel) Sets the video panel.boolean
Methods inherited from class org.opensourcephysics.media.core.Filter
addLocation, clear, copy, finalize, getFilteredImage, getFrame, getInspector, getMenu, getPixels, getPixelsIn, getPixelsOut, getRaster, initializeSource, isChanged, setEnabled
Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
PROPERTY_PERSPECTIVEFILTER_CORNERLOCATION
- See Also:
-
PROPERTY_PERSPECTIVEFILTER_FIXED
- See Also:
-
PROPERTY_PERSPECTIVEFILTER_PERSPECTIVE
- See Also:
-
-
Constructor Details
-
PerspectiveFilter
public PerspectiveFilter()Constructs a PerspectiveFilter object.
-
-
Method Details
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
-
isEnabled
public boolean isEnabled()Gets whether this filter is enabled. -
isSuperEnabled
public boolean isSuperEnabled()Gets whether the super-class of this filter is enabled.- Returns:
true
if super is enabled.
-
newInspector
- Specified by:
newInspector
in classFilter
-
initInspector
- Specified by:
initInspector
in classFilter
-
refresh
public void refresh()Refreshes this filter's GUI -
dispose
public void dispose()Description copied from class:Filter
Disposes of this filter. -
setVideoPanel
Sets the video panel.- Overrides:
setVideoPanel
in classFilter
- Parameters:
panel
- the video panel
-
setFixed
public void setFixed(boolean fix, boolean in) Sets the fixed position behavior (all frames identical).- Parameters:
fix
- true to set the corner positions the same in all framesin
- true for input corners, false for output
-
isFixed
public boolean isFixed(boolean in) Gets the fixed position behavior.- Returns:
- true if fixed
-
setCornerLocation
public void setCornerLocation(int frameNumber, int cornerIndex, double x, double y) Sets the location of a corner.- Parameters:
frameNumber
- the video frame numbercornerIndex
- the corner index (0-3)x
- the x-positiony
- the y-position
-
getColor
Gets the color.- Returns:
- the color
-
getCornerIndex
Gets the index associated with a corner point.- Parameters:
corner
- the corner- Returns:
- the index
-
getCorner
Gets the corner associated with an index.- Parameters:
index
- the index (0-7)- Returns:
- the corner
-
deleteKeyFrame
Deletes the key frame associated with a corner.- Parameters:
frameNumber
- the frame numbercorner
- the corner
-
setInputEnabled
public void setInputEnabled(boolean enable) Sets the inspector tab to input or output.- Parameters:
enable
- true to show the input tab, false to show the output tab
-
isInputEnabled
public boolean isInputEnabled()Determines if the inspector tab is the input tab.- Returns:
- true if the input tab is shown
-
isActive
public boolean isActive()Determines if the inspector is active.- Returns:
- true if the active
-
hasInspector
public boolean hasInspector()Determines if the inspector has been instantiated.- Returns:
- true if the inspector exists
-
initializeSubclass
protected void initializeSubclass()Creates the input and output images and ColorConvertOp.- Specified by:
initializeSubclass
in classFilter
- Parameters:
image
- a new input image
-
setOutputPixels
protected void setOutputPixels()Sets the output image pixels to a rotated version of the input pixels.- Specified by:
setOutputPixels
in classFilter
-
getLoader
Returns an XML.ObjectLoader to save and load filter data.- Returns:
- the object loader
-
superIsEnabled
public boolean superIsEnabled()
-