jAER project on SourceForge

net.sf.jaer.eventprocessing.label
Class SimpleOrientationFilter

java.lang.Object
  extended by net.sf.jaer.eventprocessing.EventFilter
      extended by net.sf.jaer.eventprocessing.EventFilter2D
          extended by net.sf.jaer.eventprocessing.label.SimpleOrientationFilter
All Implemented Interfaces:
java.util.Observer, FrameAnnotater
Direct Known Subclasses:
HopfieldRecognitionFilter

public class SimpleOrientationFilter
extends EventFilter2D
implements java.util.Observer, FrameAnnotater

Computes simple-type orientation-tuned cells. A switch allows WTA mode (only max 1 event generated) or many event (any orientation that passes coincidence threshold. Another switch allows contour enhancement by using previous output orientation events to make it easier to make events along the same orientation. Another switch decides whether to use max delay or average delay as the coincidence measure.

Orientation type output takes values 0-3; 0 is a horizontal edge (0 deg), 1 is an edge tilted up and to right (rotated CCW 45 deg), 2 is a vertical edge (rotated 90 deg), 3 is tilted up and to left (rotated 135 deg from horizontal edge). The filter takes either PolarityEvents or BinocularEvents to create OrientationEvents or BinocularOrientationEvents.

Author:
tobi/phess

Field Summary
static int MAX_LENGTH
           
protected  int minDtThreshold
          events must occur within this time along orientation in us to generate an event
 int NUM_TYPES
          the number of cell output types
 
Fields inherited from class net.sf.jaer.eventprocessing.EventFilter2D
enclosedFilter, out
 
Fields inherited from class net.sf.jaer.eventprocessing.EventFilter
annotationEnabled, chip, enclosedFilterChain, filterEnabled, log, perf, propertyTooltipMap, support
 
Constructor Summary
SimpleOrientationFilter(AEChip chip)
          Creates a new instance of SimpleOrientationFilter
 
Method Summary
 void annotate(float[][][] frame)
          annotate the RGB frame somehow by color pixels in the rendered pixel frame data.
 void annotate(javax.media.opengl.GLAutoDrawable drawable)
          Each annotator enters annotate with graphics context current, in coordinates with pixel 0,0 in LL corner (note opposite from Java2D) and pixel spacing 1 unit after the scaling transform (which is already active).
 void annotate(java.awt.Graphics2D g)
          each annotator is called by the relevant class (e.g.
 EventPacket filterPacket(EventPacket in)
          filters in to out.
static java.lang.String getDescription()
           
 int getDtRejectMultiplier()
           
 java.lang.Object getFilterState()
          should return the filter state in some useful form
 int getLength()
           
 int getMinDtThreshold()
           
 float getOriDiffThreshold()
           
 VectorHistogram getOriHist()
           
 float getOriHistoryMixingFactor()
           
 int getSubSampleShift()
           
 int getWidth()
           
 void initFilter()
          this should allocate and initialize memory: it may be called when the chip e.g.
 boolean isGeneratingFilter()
           
 boolean isMultiOriOutputEnabled()
           
 boolean isOriHistoryEnabled()
           
 boolean isPassAllEvents()
           
 boolean isShowGlobalEnabled()
           
 boolean isShowVectorsEnabled()
           
 boolean isUseAverageDtEnabled()
           
 void resetFilter()
          should reset the filter to initial state
 void setDtRejectMultiplier(int dtRejectMultiplier)
           
 void setFilterEnabled(boolean yes)
          overrides super method to allocate or free local memory
 void setLength(int searchDistance)
           
 void setMinDtThreshold(int minDtThreshold)
           
 void setMultiOriOutputEnabled(boolean multiOriOutputEnabled)
           
 void setOriDiffThreshold(float oriDiffThreshold)
           
 void setOriHist(VectorHistogram oriHist)
           
 void setOriHistoryEnabled(boolean oriHistoryEnabled)
           
 void setOriHistoryMixingFactor(float oriHistoryMixingFactor)
           
 void setPassAllEvents(boolean passAllEvents)
          Set this to true to pass all events even if they don't satisfy orientation test.
 void setShowGlobalEnabled(boolean showGlobalEnabled)
           
 void setShowVectorsEnabled(boolean showVectorsEnabled)
           
 void setSubSampleShift(int subSampleShift)
          Sets the number of spatial bits to subsample events times by.
 void setUseAverageDtEnabled(boolean useAverageDtEnabled)
           
 void setWidth(int width)
           
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class net.sf.jaer.eventprocessing.EventFilter2D
checkOutputPacketEventType, checkOutputPacketEventType, getEnclosedFilter, resetOut, setEnclosedFilter
 
Methods inherited from class net.sf.jaer.eventprocessing.EventFilter
getChip, getEnclosedFilterChain, getEnclosingFilter, getPrefs, getPropertyChangeSupport, getPropertyTooltip, isAnnotationEnabled, isEnclosed, isFilterEnabled, prefsEnabledKey, setAnnotationEnabled, setChip, setEnclosed, setEnclosedFilter, setEnclosedFilterChain, setEnclosingFilter, setPreferredEnabledState, setPrefs, setPropertyTooltip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jaer.graphics.FrameAnnotater
isAnnotationEnabled, setAnnotationEnabled
 

Field Detail

minDtThreshold

protected int minDtThreshold
events must occur within this time along orientation in us to generate an event


NUM_TYPES

public final int NUM_TYPES
the number of cell output types

See Also:
Constant Field Values

MAX_LENGTH

public static final int MAX_LENGTH
See Also:
Constant Field Values
Constructor Detail

SimpleOrientationFilter

public SimpleOrientationFilter(AEChip chip)
Creates a new instance of SimpleOrientationFilter

Method Detail

getDescription

public static java.lang.String getDescription()

isGeneratingFilter

public boolean isGeneratingFilter()

getFilterState

public java.lang.Object getFilterState()
Description copied from class: EventFilter
should return the filter state in some useful form

Specified by:
getFilterState in class EventFilter

resetFilter

public void resetFilter()
Description copied from class: EventFilter
should reset the filter to initial state

Specified by:
resetFilter in class EventFilter

setFilterEnabled

public void setFilterEnabled(boolean yes)
overrides super method to allocate or free local memory

Overrides:
setFilterEnabled in class EventFilter2D
Parameters:
yes - true to reset
See Also:
EventFilter.setPreferredEnabledState()

getMinDtThreshold

public int getMinDtThreshold()

setMinDtThreshold

public void setMinDtThreshold(int minDtThreshold)

getOriHist

public VectorHistogram getOriHist()

setOriHist

public void setOriHist(VectorHistogram oriHist)

isUseAverageDtEnabled

public boolean isUseAverageDtEnabled()

setUseAverageDtEnabled

public void setUseAverageDtEnabled(boolean useAverageDtEnabled)

isMultiOriOutputEnabled

public boolean isMultiOriOutputEnabled()

setMultiOriOutputEnabled

public void setMultiOriOutputEnabled(boolean multiOriOutputEnabled)

initFilter

public void initFilter()
Description copied from class: EventFilter
this should allocate and initialize memory: it may be called when the chip e.g. size parameters are changed after creation of the filter

Specified by:
initFilter in class EventFilter

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

getLength

public int getLength()

setLength

public void setLength(int searchDistance)
Parameters:
searchDistance - the length of the RF, actual length is twice this because we search on each side of pixel by length

getWidth

public int getWidth()

setWidth

public void setWidth(int width)
Parameters:
width - the width of the RF, 0 for a single line of pixels, 1 for 3 lines, etc

annotate

public void annotate(java.awt.Graphics2D g)
Description copied from interface: FrameAnnotater
each annotator is called by the relevant class (e.g. EyeTracker) and enters annotate with graphics context current, in coordinates with pixel 0,0 in UL corner and pixel spacing 1 unit before scaling transform (which is already active).

Specified by:
annotate in interface FrameAnnotater
Parameters:
g - the Graphics2D context

annotate

public void annotate(javax.media.opengl.GLAutoDrawable drawable)
Description copied from interface: FrameAnnotater
Each annotator enters annotate with graphics context current, in coordinates with pixel 0,0 in LL corner (note opposite from Java2D) and pixel spacing 1 unit after the scaling transform (which is already active). The FrameAnnotater then can use JOGL calls to render to the screen by getting the GL context, e.g. the following code, used in the context of an AEChip object, draws a golden lines from LL to UR of the pixel array.
        GL gl = drawable.getGL();
        gl.glBegin(GL.GL_LINES);
        gl.glColor3f(.5f, .5f, 0);
        gl.glVertex2f(0, 0);
        gl.glVertex2f(getSizeX() - 1, getSizeY() - 1);
        gl.glEnd();
 

Specified by:
annotate in interface FrameAnnotater
Parameters:
drawable - the OpenGL drawable components, e.g., GLCanvas

isShowVectorsEnabled

public boolean isShowVectorsEnabled()

setShowVectorsEnabled

public void setShowVectorsEnabled(boolean showVectorsEnabled)

annotate

public void annotate(float[][][] frame)
Description copied from interface: FrameAnnotater
annotate the RGB frame somehow by color pixels in the rendered pixel frame data.

Specified by:
annotate in interface FrameAnnotater
Parameters:
frame - the RGB pixel information. First dimension is Y, second is X, third is RGB

isShowGlobalEnabled

public boolean isShowGlobalEnabled()

setShowGlobalEnabled

public void setShowGlobalEnabled(boolean showGlobalEnabled)

filterPacket

public EventPacket filterPacket(EventPacket in)
filters in to out. if filtering is enabled, the number of out may be less than the number put in

Specified by:
filterPacket in class EventFilter2D
Parameters:
in - input events can be null or empty.
Returns:
the processed events, may be fewer in number.

isPassAllEvents

public boolean isPassAllEvents()

setPassAllEvents

public void setPassAllEvents(boolean passAllEvents)
Set this to true to pass all events even if they don't satisfy orientation test. These passed events have no orientation set.

Parameters:
passAllEvents - true to pass all events, false to pass only events that pass coicidence test.

getSubSampleShift

public int getSubSampleShift()

setSubSampleShift

public void setSubSampleShift(int subSampleShift)
Sets the number of spatial bits to subsample events times by. Setting this equal to 1, for example, subsamples into an event time map with halved spatial resolution, aggreating over more space at coarser resolution but increasing the search range by a factor of two at no additional cost

Parameters:
subSampleShift - the number of bits, 0 means no subsampling

getDtRejectMultiplier

public int getDtRejectMultiplier()

setDtRejectMultiplier

public void setDtRejectMultiplier(int dtRejectMultiplier)

getOriHistoryMixingFactor

public float getOriHistoryMixingFactor()

setOriHistoryMixingFactor

public void setOriHistoryMixingFactor(float oriHistoryMixingFactor)

getOriDiffThreshold

public float getOriDiffThreshold()

setOriDiffThreshold

public void setOriDiffThreshold(float oriDiffThreshold)

isOriHistoryEnabled

public boolean isOriHistoryEnabled()

setOriHistoryEnabled

public void setOriHistoryEnabled(boolean oriHistoryEnabled)

jAER project on SourceForge