jAER project on SourceForge

net.sf.jaer.eventprocessing.filter
Class HarmonicFilter

java.lang.Object
  extended by net.sf.jaer.eventprocessing.EventFilter
      extended by net.sf.jaer.eventprocessing.EventFilter2D
          extended by net.sf.jaer.eventprocessing.filter.HarmonicFilter
All Implemented Interfaces:
java.util.Observer

public class HarmonicFilter
extends EventFilter2D
implements java.util.Observer

An AE filter that filters out boring events caused by global flickering illumination. This filter measures the global event activity to obtain the phase and amplitude of flicker. If the amplitude exceeds a threashold, then events around the peak activity are filtered away. The phase and amplitude are computed by one of two methods.

The first uses a global harmonic oscillator with adjustable resonant frequency (set by user to double line frequency) and adjustable quality factor Q. This resonator is driven by ON and OFF events in opposite directions. It resonates with a phase such that it crosses zero at the peak of ON and OFF activities. During a zero crossing, events are filtered away.

The second method (planned, not yet implemented) histograms events into a cyclic histogram whose period is set as a parameter (e.g. 10 ms for 50 Hz illumination with line doubling). The histogram peaks tell the filter where to reject events. The histogram is forgotten slowly by periodically decaying all values. This method is not as physical and introduces a kind of 'frame' for forgetting, but it is slightly cheaper to compute.

Author:
tobi

Nested Class Summary
 class HarmonicFilter.HarmonicOscillator
           
 
Field Summary
 
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
HarmonicFilter(AEChip chip)
           
 
Method Summary
 EventPacket filterPacket(EventPacket in)
          Subclasses implement this method to define custom processing.
static java.lang.String getDescription()
           
 java.lang.Object getFilterState()
          returns array of last event times, x,y,type,[t0,t1], where t0/t1 are the last two event times, t0 first.
 float getFreq()
           
 float getQuality()
           
 float getThreshold()
           
 void initFilter()
          this should allocate and initialize memory: it may be called when the chip e.g.
 boolean isGeneratingFilter()
           
 boolean isPrintStats()
           
 void resetFilter()
          should reset the filter to initial state
 void setFilterEnabled(boolean yes)
          Resets the filter
 void setFreq(float f)
           
 void setPrintStats(boolean printStats)
           
 void setQuality(float q)
           
 void setThreshold(float threshold)
           
 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
 

Constructor Detail

HarmonicFilter

public HarmonicFilter(AEChip chip)
Method Detail

getDescription

public static java.lang.String getDescription()

isGeneratingFilter

public boolean isGeneratingFilter()

setFilterEnabled

public void setFilterEnabled(boolean yes)
Description copied from class: EventFilter2D
Resets the filter

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

getFilterState

public java.lang.Object getFilterState()
returns array of last event times, x,y,type,[t0,t1], where t0/t1 are the last two event times, t0 first.

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

update

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

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

getThreshold

public float getThreshold()

setThreshold

public void setThreshold(float threshold)

getQuality

public float getQuality()

setQuality

public void setQuality(float q)

getFreq

public float getFreq()

setFreq

public void setFreq(float f)

isPrintStats

public boolean isPrintStats()

setPrintStats

public void setPrintStats(boolean printStats)

filterPacket

public EventPacket filterPacket(EventPacket in)
Description copied from class: EventFilter2D
Subclasses implement this method to define custom processing.

Specified by:
filterPacket in class EventFilter2D
Parameters:
in - the input packet
Returns:
the output packet

jAER project on SourceForge