org.opensourcephysics.media.core
Class PerspectiveFilter

java.lang.Object
  extended by org.opensourcephysics.media.core.Filter
      extended by org.opensourcephysics.media.core.PerspectiveFilter

public class PerspectiveFilter
extends Filter

This is a Filter that corrects perspective in the source image.

Version:
1.0
Author:
Douglas Brown

Nested Class Summary
 class PerspectiveFilter.Corner
           
 
Field Summary
protected static java.awt.font.FontRenderContext frc
           
 
Fields inherited from class org.opensourcephysics.media.core.Filter
ableButton, clearButton, closeButton, deleteItem, enabledAction, enabledItem, frame, hasInspector, inspectorVisible, inspectorX, inspectorY, propertiesItem, stack, support, vidPanel
 
Constructor Summary
PerspectiveFilter()
          Constructs a PerspectiveFilter object.
 
Method Summary
 void deleteKeyFrame(int frameNumber, PerspectiveFilter.Corner corner)
          Deletes the key frame associated with a corner.
 java.awt.Color getColor()
          Gets the color.
 PerspectiveFilter.Corner getCorner(int index)
          Gets the corner associated with an index.
 int getCornerIndex(PerspectiveFilter.Corner corner)
          Gets the index associated with a corner point.
 java.awt.image.BufferedImage getFilteredImage(java.awt.image.BufferedImage sourceImage)
          Applies the filter to a source image and returns the result.
 javax.swing.JDialog getInspector()
          Gets the inspector for this filter.
static XML.ObjectLoader getLoader()
          Returns an XML.ObjectLoader to save and load filter data.
 boolean hasInspector()
          Determines if the inspector has been instantiated.
 boolean isActive()
          Determines if the inspector is active.
 boolean isEnabled()
          Gets whether this filter is enabled.
 boolean isFixed()
          Gets the fixed position behavior.
 boolean isInputEnabled()
          Determines if the inspector tab is the input tab.
 void refresh()
          Refreshes this filter's GUI
 void setCornerLocation(int frameNumber, int cornerIndex, double x, double y)
          Sets the location of a corner.
 void setFixed(boolean fix)
          Sets the fixed position behavior (all frames identical).
 void setInputEnabled(boolean enable)
          Sets the inspector tab to input or output.
 void setVideoPanel(VideoPanel panel)
          Sets the video panel.
 
Methods inherited from class org.opensourcephysics.media.core.Filter
addPropertyChangeListener, addPropertyChangeListener, clear, getMenu, removePropertyChangeListener, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

frc

protected static java.awt.font.FontRenderContext frc
Constructor Detail

PerspectiveFilter

public PerspectiveFilter()
Constructs a PerspectiveFilter object.

Method Detail

getFilteredImage

public java.awt.image.BufferedImage getFilteredImage(java.awt.image.BufferedImage sourceImage)
Applies the filter to a source image and returns the result.

Specified by:
getFilteredImage in class Filter
Parameters:
sourceImage - the source image
Returns:
the filtered image

isEnabled

public boolean isEnabled()
Gets whether this filter is enabled.

Overrides:
isEnabled in class Filter
Returns:
true if this is enabled.

getInspector

public javax.swing.JDialog getInspector()
Gets the inspector for this filter.

Specified by:
getInspector in class Filter
Returns:
the inspector

refresh

public void refresh()
Refreshes this filter's GUI

Overrides:
refresh in class Filter

setVideoPanel

public void setVideoPanel(VideoPanel panel)
Sets the video panel.

Overrides:
setVideoPanel in class Filter
Parameters:
panel - the video panel

setFixed

public void setFixed(boolean fix)
Sets the fixed position behavior (all frames identical).

Parameters:
fix - true to set the corner positions the same in all frames

isFixed

public boolean isFixed()
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 number
cornerIndex - the corner index (0-3)
x - the x-position
y - the y-position

getColor

public java.awt.Color getColor()
Gets the color.

Returns:
the color

getCornerIndex

public int getCornerIndex(PerspectiveFilter.Corner corner)
Gets the index associated with a corner point.

Parameters:
corner - the corner
Returns:
the index

getCorner

public PerspectiveFilter.Corner getCorner(int index)
Gets the corner associated with an index.

Parameters:
index - the index (0-7)
Returns:
the corner

deleteKeyFrame

public void deleteKeyFrame(int frameNumber,
                           PerspectiveFilter.Corner corner)
Deletes the key frame associated with a corner.

Parameters:
frameNumber - the frame number
corner - 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

getLoader

public static XML.ObjectLoader getLoader()
Returns an XML.ObjectLoader to save and load filter data.

Returns:
the object loader