Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

FilterBankGenerator Class Reference

#include <FilterBankGenerator.h>

Inheritance diagram for FilterBankGenerator:

List of all members.


Detailed Description

Abstract base class for generators of FilterBankEvent's.

This is needed to provide an interface for the FilterBankEvent to call back when the actual image data is requested from it. This facilitates lazy calculation of image data... no sense in processing layers or channels which aren't actually going to be used...

Also this way we save on allocating/deallocating large memory blocks on each event... the buffers allocated here can be reused frame to frame.

Larger layer indicies generally indicate higher resolution images in a scaling pyramid, but you are free to store your own data however you wish.

Serialization Format

First, be sure to get a good overview of the LoadSave style. Most serialization is handled using this interface.

When, for instance, RawCameraGenerator::saveBuffer() is called, it first calls it's super class, FilterBankGenerator::saveBuffer(), which will write out the general image information, common to all subclasses of FilterBankGenerator. (i'll cover the specifics in a second) Once that's done, the RawCameraGenerator adds it's own bit of header and then saves the image data itself.

Note that only a single channel is being saved at this point. So for instance, all the Y information. No interleaving is going on. (unless you're saving from InterleavedYUVGenerator of course, which treats the 3 interleaved channels as a single image) Otherwise,only one image (selected with selectSaveImage()) of the bank will loaded or saved at a time.

So, anyway. The first header will be the same for all FilterBankGenerator subclasses. In the specification below, I'm going to use one field per line (the new lines are not literal, it's a binary stream). Each field is of the form '<type:name> (notes)'

FilterBankGenerator Header: (from FilterBankGenerator::saveBuffer())

  • <string: "FbkImage"> (remember a 'string' is len+str+0; so this is the literal "\010\0\0\0FbkImage\0"; also remember "\010" is octal for 8)
  • <unsigned int: width>
  • <unsigned int: height>
  • <unsigned int: image layer>
  • <unsigned int: image channel> (so notice you can tell which channel it is after it's been saved)

Generator Specific Header (selected examples follow, or similarly, any of the other generators)

  • RawCameraGenerator: (from RawCameraGenerator::saveBuffer())
    • <string: "RawImage">
    • <char[width*height]: image data> (note, just once channel being stored)
  • InterleavedYUVGenerator: (from InterleavedYUVGenerator::saveBuffer())
    • <string: "InterleavedYUVImage">
    • <char[width*height*3]: image data> (in YVU order, technically YCbCr)
  • SegmentedColorGenerator: (from SegmentedColorGenerator::saveBuffer())
    • <string: "SegColorImage">
    • <char[width*height]: image data> (one byte per sample)
    • <unsigned int: num_cols> (number of different colors available)
    • for each of num_col:
      • <char: red> red color to use for display of this index
      • <char: green> green color to use for display of this index
      • <char: blue> blue color to use for display of this index
  • RLEGenerator: (from RLEGenerator::saveBuffer())
    • <string: "RLEImage"> (remember a 'string' is len+str+0; so this is the literal "\010\0\0\0RLEImage\0"; also remember "\010" is octal for 8)
    • <unsigned int: num_runs> (how many runs will follow)
    • for each of num_runs:
      • <char: color> (index value of color of run)
      • <short: x> (x position of start of run ("unknown" runs are skipped - assume index 0 for pixels which are jumped))
      • <short: width> (length of run, will not exceed remaining width of image)
    • notice there's no color information from RLE - it's not (shouldn't be) assuming anything about the data being compressed)

However, while we're on the topic, I'll mention that although this is the same image format used for streaming to VisionGUI, there's a few more fields added by RawCamBehavior or SegCamBehavior at the beginning of each packet. See those classes for more information on the wireless protocol. That should tell you everything you need to know to interpret the vision stream as well.

Adding New FilterBankGenerator Subclasses

If you're doing fancy memory stuff, you probably want to override the freeCaches() and destruct() functions so that the default implementation won't try to free something it shouldn't. Don't forget to call them from your own destructor though, otherwise your versions won't get called before the default implementation's does.

If you want to be able to transmit or save your images, you will need to override the LoadSave functions (listed below) to provide your own code for interpreting the image data itself, and then create or modify a behavior to open a socket and transmit the information. (you could do that from within the generator itself if you like)

You will probably also want to add a few extra functions to allow users to set compression/data format parameters.

See also:
RawCameraGenerator, SegmentedColorGenerator for the basic image access

RLEGenerator, RegionGenerator for some relatively simple examples of vision stages if you want to make some of your own.

Definition at line 112 of file FilterBankGenerator.h.


Public Member Functions

virtual ~FilterBankGenerator ()
 destructor
virtual const FilterBankGeneratorgetSourceGenerator () const
 returns the generator this is receiving its events from (or the last one anyway)
virtual unsigned int getNumLayers () const
 returns the number of image layers (e.g. different resolutions available)
virtual unsigned int getNumChannels () const
 returns the number of channels per image (e.g. Y, U, or V components)
virtual unsigned char * getImage (unsigned int layer, unsigned int channel)
 returns pointer to the beginning of the image data for the specified layer and channel
virtual bool getImageCached (unsigned int layer, unsigned int channel) const
 returns whether or not an image has already been calculated for the current frame
unsigned int getWidth (unsigned int layer) const
 returns width (in samples) of the image in a given layer
unsigned int getHeight (unsigned int layer) const
 returns height (in samples) of the image in a given layer
unsigned int getSkip (unsigned int layer) const
 returns the bytes to skip from the one-past-end of a row to get the beginning of the next
unsigned int getStride (unsigned int layer) const
 returns the bytes to skip from the beginning of one row to get the beginning of the next
unsigned int getIncrement (unsigned int layer) const
 returns the increment (in bytes) to use to go from one sample to the next
unsigned int getFrameNumber () const
 returns the frame number of the current frame, see frameNumber
unsigned int getFramesProcessed () const
 returns the number of frames processed, see framesProcessed
unsigned char * getPixel (unsigned int px, unsigned int py, unsigned int layer, unsigned int channel)
 returns a pointer to a particular sample; if you are using this in an inner loop, consider using the getSkip() and getIncrement() values to iterate with better performance
unsigned char * getPixel (float x, float y, unsigned int layer, unsigned int channel)
 returns a pointer to a particular sample; if you are using this in an inner loop, consider using the getSkip() and getIncrement() values to iterate with better performance
void getPixelCoordinates (unsigned int &px, unsigned int &py, float x, float y, unsigned int layer) const
 sets the pixel-coordinate px and py parameters to the corresponding value of x and y
void getRealCoordinates (float &x, float &y, unsigned int px, unsigned int py, unsigned int layer) const
 sets the x and y parameters from the pixel-coordinates px and py
virtual void freeCaches ()
 deletes storage of cached images and marks it invalid
virtual void invalidateCaches ()
 marks all of the cached images as invalid (but doesn't free their memory)
virtual void processEvent (const EventBase &event)
 default implementation does a few common housekeeping chores for you - probably should just take a look at its code
LoadSave interface
virtual unsigned int getBinSize () const
 Calculates space needed to save - if you can't precisely add up the size, just make sure to overestimate and things will still work.
virtual unsigned int loadBuffer (const char buf[], unsigned int len)
virtual unsigned int saveBuffer (char buf[], unsigned int len) const
 Save to a given buffer in memory.
virtual void selectSaveImage (unsigned int layer, unsigned int channel)
 Not actually part of the LoadSave interface, but allows you to select which image of the bank will be saved.
virtual unsigned int getSelectedSaveLayer () const
 returns layer to be saved, or layer of last image loaded
virtual unsigned int getSelectedSaveChannel () const
 returns channel to be saved, or channel of last image loaded

Protected Member Functions

 FilterBankGenerator (const std::string &classname, const std::string &instancename, EventBase::EventGeneratorID_t mgid, unsigned int msid, EventBase::EventGeneratorID_t srcegid, unsigned int srcsrc)
 constructor, separate class and instance names, with a raw event specification, excluding type typically for stages which reference the previous stage's data
 FilterBankGenerator (const std::string &classname, const std::string &instancename, EventBase::EventGeneratorID_t mgid, unsigned int msid, EventBase::EventGeneratorID_t srcegid, unsigned int srcsrc, EventBase::EventTypeID_t srcetid)
 constructor, separate class and instance names, with a raw event specification, including type typically for stages which will store their own copy of the data
 FilterBankGenerator (const std::string &classname, const std::string &instancename, EventBase::EventGeneratorID_t mgid, unsigned int msid, FilterBankGenerator *fbgsrc)
 constructor, separate class and instance names, with a filter bank source, passes on all types typically for stages which reference the previous stage's data
 FilterBankGenerator (const std::string &classname, const std::string &instancename, EventBase::EventGeneratorID_t mgid, unsigned int msid, FilterBankGenerator *fbgsrc, EventBase::EventTypeID_t etid)
 constructor, separate class and instance names, with a filter bank source, accepts a particular type typically for stages which will store their own data
virtual void setNumImages (unsigned int nLayers, unsigned int nChannels)
 resizes the filter bank information storage area, you should override this to do your setup and call it from your constructor
virtual void setDimensions ()
 resets width and height parameters to that of the src
virtual unsigned char * createImageCache (unsigned int layer, unsigned int channel) const =0
 create new image data storage area for the cache - this called by getImage() only when the corresponding entry in images is NULL
virtual void calcImage (unsigned int layer, unsigned int channel)=0
 should calculate new image data, called by getImage() only when imageValids indicates the image being requested is dirty (and only after getImage() has already called createImageCache())
virtual void destruct ()
 deletes the arrays
virtual bool refresh ()
 updates the image data to make sure its up to date with what's available from the source

Protected Attributes

FilterBankGeneratorsrc
 the generator of the last FilterBankEvent received
unsigned int numLayers
 current number of layers available
unsigned int numChannels
 current number of channels available
unsigned int * widths
 an array of size numLayers, width (in samples) in pixels of each layer
unsigned int * heights
 an array of size numLayers, height (in samples) in pixels of each layer
unsigned int * skips
 an array of size numLayers, skip (in bytes) from row end to next row begin
unsigned int * strides
 an array of size numLayers, stride (in bytes) from a given column in one row to the same column in the next row
unsigned int * increments
 an array of size numLayers, increment (in bytes) to use to get from one sample to the next
unsigned char *** images
 an array [numLayers][numChannels], stores pointer to cached image data
bool ** imageValids
 an array [numLayers][numChannels], entry is true if cached data is still valid
unsigned int selectedSaveLayer
 layer to be manipulated with the LoadSave functions
unsigned int selectedSaveChannel
 channel to be manipulated with the LoadSave functions
unsigned int frameNumber
 the frame number of last frame received by processEvent - subclasses will need to set to the source's frameNumber if they don't call FilterBankGenerator::processEvent()
unsigned int framesProcessed
 subclasses should increment this any time they make a new filter bank available

Static Protected Attributes

static unsigned int sysFrameNumber = -1U
 the current frame number available from the system - subclasses which receive data directly from the system should set this (and should not use EventGeneratorBase's auto-listen to ensure this is accurate)

Private Member Functions

 FilterBankGenerator (const FilterBankGenerator &fbk)
 don't call
const FilterBankGeneratoroperator= (const FilterBankGenerator &fbk)
 don't call

Constructor & Destructor Documentation

virtual FilterBankGenerator::~FilterBankGenerator (  )  [inline, virtual]

destructor

Your own subclasses should also have destructors which call freeCaches() and destruct(). Otherwise, if you override these functions to delete any custom memory you allocate, those implementations won't be called by this destructor... a destructor ignores virtual functions, only calls at its own class level.
So it really doesn't matter if you aren't allocating any extra memory other than what's in the image cache, but it's still good form just in case you add stuff later so you won't forget and leak memory everywhere

Definition at line 128 of file FilterBankGenerator.h.

FilterBankGenerator::FilterBankGenerator ( const std::string &  classname,
const std::string &  instancename,
EventBase::EventGeneratorID_t  mgid,
unsigned int  msid,
EventBase::EventGeneratorID_t  srcegid,
unsigned int  srcsrc 
) [inline, protected]

constructor, separate class and instance names, with a raw event specification, excluding type typically for stages which reference the previous stage's data

Definition at line 268 of file FilterBankGenerator.h.

FilterBankGenerator::FilterBankGenerator ( const std::string &  classname,
const std::string &  instancename,
EventBase::EventGeneratorID_t  mgid,
unsigned int  msid,
EventBase::EventGeneratorID_t  srcegid,
unsigned int  srcsrc,
EventBase::EventTypeID_t  srcetid 
) [inline, protected]

constructor, separate class and instance names, with a raw event specification, including type typically for stages which will store their own copy of the data

Definition at line 276 of file FilterBankGenerator.h.

FilterBankGenerator::FilterBankGenerator ( const std::string &  classname,
const std::string &  instancename,
EventBase::EventGeneratorID_t  mgid,
unsigned int  msid,
FilterBankGenerator fbgsrc 
) [inline, protected]

constructor, separate class and instance names, with a filter bank source, passes on all types typically for stages which reference the previous stage's data

Definition at line 284 of file FilterBankGenerator.h.

FilterBankGenerator::FilterBankGenerator ( const std::string &  classname,
const std::string &  instancename,
EventBase::EventGeneratorID_t  mgid,
unsigned int  msid,
FilterBankGenerator fbgsrc,
EventBase::EventTypeID_t  etid 
) [inline, protected]

constructor, separate class and instance names, with a filter bank source, accepts a particular type typically for stages which will store their own data

Definition at line 295 of file FilterBankGenerator.h.

FilterBankGenerator::FilterBankGenerator ( const FilterBankGenerator fbk  )  [private]

don't call


Member Function Documentation

virtual const FilterBankGenerator* FilterBankGenerator::getSourceGenerator (  )  const [inline, virtual]

returns the generator this is receiving its events from (or the last one anyway)

Definition at line 134 of file FilterBankGenerator.h.

Referenced by RegionGenerator::RegionGenerator(), RegionCamBehavior::writeRegions(), and SegCamBehavior::writeRLE().

virtual unsigned int FilterBankGenerator::getNumChannels (  )  const [inline, virtual]

virtual bool FilterBankGenerator::getImageCached ( unsigned int  layer,
unsigned int  channel 
) const [inline, virtual]

returns whether or not an image has already been calculated for the current frame

If you call this immediately after getImage() and this still returns false, then an error must have occurred during processing

Definition at line 149 of file FilterBankGenerator.h.

unsigned int FilterBankGenerator::getStride ( unsigned int  layer  )  const [inline]

returns the bytes to skip from the beginning of one row to get the beginning of the next

This is just for convenience; the stride is just the skip plus the width, but it's precomputed for you for speed and clarity

Definition at line 162 of file FilterBankGenerator.h.

Referenced by BufferedImageGenerator::calcDx(), BufferedImageGenerator::calcDy(), SegmentedColorGenerator::calcImage(), RawCameraGenerator::calcImage(), InterleavedYUVGenerator::createImageCache(), getPixel(), FilterBankEvent::getStride(), RawCameraGenerator::saveBuffer(), BufferedImageGenerator::saveBuffer(), RawCameraGenerator::saveFileStream(), BufferedImageGenerator::saveFileStream(), and Graphics::updateFBG().

unsigned int FilterBankGenerator::getFrameNumber (  )  const [inline]

returns the frame number of the current frame, see frameNumber

Definition at line 168 of file FilterBankGenerator.h.

Referenced by FilterBankEvent::getFrameNumber(), SegCamBehavior::openPacket(), RegionCamBehavior::openPacket(), RawCamBehavior::openPacket(), and refresh().

unsigned int FilterBankGenerator::getFramesProcessed (  )  const [inline]

returns the number of frames processed, see framesProcessed

Definition at line 171 of file FilterBankGenerator.h.

Referenced by FilterBankEvent::getFramesProcessed().

unsigned char* FilterBankGenerator::getPixel ( unsigned int  px,
unsigned int  py,
unsigned int  layer,
unsigned int  channel 
) [inline]

returns a pointer to a particular sample; if you are using this in an inner loop, consider using the getSkip() and getIncrement() values to iterate with better performance

Parameters:
px the horizontal pizel position, relative to left edge; no boundary checking is done, ranges 0 through width-1
py the vertical pixel position, relative to top edge; no boundary checking is done, ranges 0 through height-1
layer the resolution layer to extract from
channel the image channel to extract from

Definition at line 178 of file FilterBankGenerator.h.

Referenced by getPixel().

unsigned char* FilterBankGenerator::getPixel ( float  x,
float  y,
unsigned int  layer,
unsigned int  channel 
) [inline]

returns a pointer to a particular sample; if you are using this in an inner loop, consider using the getSkip() and getIncrement() values to iterate with better performance

Parameters:
x the horizontal position, relative to center of the image, left edge is -1 and right edge is 1; no boundary checking is done
y the vertical pixel position, relative to center of the image, top edge is the negative aspect ratio, bottom edge is positive aspect ratio; no boundary checking is done
layer the resolution layer to extract from
channel the image channel to extract from
To keep the coordinate system square, the x is defined to range -1,1, but y's range depends on the aspect ratio of the image, height/width. Thus typically y will approx. -.75,.75

Definition at line 188 of file FilterBankGenerator.h.

void FilterBankGenerator::getPixelCoordinates ( unsigned int &  px,
unsigned int &  py,
float  x,
float  y,
unsigned int  layer 
) const [inline]

sets the pixel-coordinate px and py parameters to the corresponding value of x and y

Parameters:
[out] px the pixel position, relative to left edge, positive right, ranges 0 through width-1
[out] py the pixel position, relative to top edge, positive down, ranges 0 through height-1
[in] x the horizontal position, relative to center of the image, left edge is -1 and right edge is 1; no boundary checking is done
[in] y the vertical pixel position, relative to center of the image, top edge is the negative aspect ratio, bottom edge is positive aspect ratio; no boundary checking is done
[in] layer the resolution layer the pixel coordinates are relative to
To keep the coordinate system square, the x is defined to range -1,1, but y's range depends on the aspect ratio of the image, height/width. Thus typically y will approx. -.75,.75

Definition at line 203 of file FilterBankGenerator.h.

Referenced by getPixel(), and Graphics::getPixelCoordinates().

void FilterBankGenerator::getRealCoordinates ( float &  x,
float &  y,
unsigned int  px,
unsigned int  py,
unsigned int  layer 
) const [inline]

sets the x and y parameters from the pixel-coordinates px and py

Parameters:
[out] x the horizontal position, relative to center of the image, left edge is -1 and right edge is 1; no boundary checking is done
[out] y the vertical pixel position, relative to center of the image, top edge is the negative aspect ratio, bottom edge is positive aspect ratio; no boundary checking is done
[in] px the pixel position, relative to left edge, positive right, ranges 0 through width-1
[in] py the pixel position, relative to top edge, positive down, ranges 0 through height-1
[in] layer the resolution layer the pixel coordinates are relative to
To keep the coordinate system square, the x is defined to range -1,1, but y's range depends on the aspect ratio of the image, height/width. Thus typically y will approx. -.75,.75

Definition at line 219 of file FilterBankGenerator.h.

Referenced by Graphics::getRealCoordinates().

void FilterBankGenerator::freeCaches (  )  [virtual]

deletes storage of cached images and marks it invalid

you should override this if the images cache pointer isn't actually an array of bytes... Don't forget to call it in your subclass's destructor or your version won't get called...

Reimplemented in BufferedImageGenerator, CDTGenerator, InterleavedYUVGenerator, RawCameraGenerator, and RegionGenerator.

Definition at line 27 of file FilterBankGenerator.cc.

Referenced by RegionGenerator::freeCaches(), RawCameraGenerator::freeCaches(), InterleavedYUVGenerator::freeCaches(), CDTGenerator::freeCaches(), BufferedImageGenerator::freeCaches(), setDimensions(), setNumImages(), ~FilterBankGenerator(), JPEGGenerator::~JPEGGenerator(), PNGGenerator::~PNGGenerator(), RLEGenerator::~RLEGenerator(), and SegmentedColorGenerator::~SegmentedColorGenerator().

void FilterBankGenerator::invalidateCaches (  )  [virtual]

marks all of the cached images as invalid (but doesn't free their memory)

You probably want to call this right before you send the FilterBankEvent

Reimplemented in BufferedImageGenerator, and InterleavedYUVGenerator.

Definition at line 37 of file FilterBankGenerator.cc.

Referenced by freeCaches(), RawCameraGenerator::processEvent(), CDTGenerator::processEvent(), refresh(), and JPEGGenerator::setQuality().

void FilterBankGenerator::processEvent ( const EventBase event  )  [virtual]

default implementation does a few common housekeeping chores for you - probably should just take a look at its code

It doesn't throw any events for you - that's probably the main reason you'd still want to override it
Also, if your class has a set number of layers or channels - for instance, always 1 channel like InterleavedYUVGenerator, you should override setNumImages() to enforce that constraint by throwing away the appropriate argument and passing the your own value to the superclass implementation.

Reimplemented from EventGeneratorBase.

Reimplemented in BufferedImageGenerator, CDTGenerator, InterleavedYUVGenerator, JPEGGenerator, PNGGenerator, RawCameraGenerator, RegionGenerator, RLEGenerator, and SegmentedColorGenerator.

Definition at line 44 of file FilterBankGenerator.cc.

Referenced by SegmentedColorGenerator::processEvent(), RLEGenerator::processEvent(), RegionGenerator::processEvent(), PNGGenerator::processEvent(), JPEGGenerator::processEvent(), and InterleavedYUVGenerator::processEvent().

unsigned int FilterBankGenerator::getBinSize (  )  const [virtual]

Calculates space needed to save - if you can't precisely add up the size, just make sure to overestimate and things will still work.

getBinSize is used for reserving buffers during serialization, but does not necessarily determine the actual size of what is written -- the return value of saveBuffer() specifies that after the data actually has been written. If getBinSize overestimates, the extra memory allocation is only temporary, no extra filler bytes are actually stored.

Returns:
number of bytes read/written, 0 if error (or empty)

Implements LoadSave.

Reimplemented in BufferedImageGenerator, CDTGenerator, InterleavedYUVGenerator, JPEGGenerator, PNGGenerator, RawCameraGenerator, RegionGenerator, RLEGenerator, and SegmentedColorGenerator.

Definition at line 58 of file FilterBankGenerator.cc.

Referenced by SegmentedColorGenerator::getBinSize(), RLEGenerator::getBinSize(), RegionGenerator::getBinSize(), RawCameraGenerator::getBinSize(), PNGGenerator::getBinSize(), JPEGGenerator::getBinSize(), InterleavedYUVGenerator::getBinSize(), CDTGenerator::getBinSize(), BufferedImageGenerator::getBinSize(), EventLogger::logImage(), RawCameraGenerator::saveFileStream(), and BufferedImageGenerator::saveFileStream().

unsigned int FilterBankGenerator::loadBuffer ( const char  buf[],
unsigned int  len 
) [virtual]

unsigned int FilterBankGenerator::saveBuffer ( char  buf[],
unsigned int  len 
) const [virtual]

virtual void FilterBankGenerator::selectSaveImage ( unsigned int  layer,
unsigned int  channel 
) [inline, virtual]

Not actually part of the LoadSave interface, but allows you to select which image of the bank will be saved.

Calling this will also cause the image data for that image to be calculated, otherwise saveBuffer won't have up-to-date data to save.

When loading, the saved image's layer and channel will reset this

Definition at line 258 of file FilterBankGenerator.h.

Referenced by EventLogger::logImage(), RawCamBehavior::writeColor(), RegionCamBehavior::writeRegions(), SegCamBehavior::writeRLE(), SegCamBehavior::writeSeg(), and RawCamBehavior::writeSingleChannel().

virtual unsigned int FilterBankGenerator::getSelectedSaveLayer (  )  const [inline, virtual]

returns layer to be saved, or layer of last image loaded

Definition at line 260 of file FilterBankGenerator.h.

virtual unsigned int FilterBankGenerator::getSelectedSaveChannel (  )  const [inline, virtual]

returns channel to be saved, or channel of last image loaded

Definition at line 261 of file FilterBankGenerator.h.

void FilterBankGenerator::setNumImages ( unsigned int  nLayers,
unsigned int  nChannels 
) [protected, virtual]

resizes the filter bank information storage area, you should override this to do your setup and call it from your constructor

In general, it isn't expected that FilterBankGenerator's should necessarily be dynamically resizeable (although it would be nice), which is why this isn't public. If yours is, just add some pubic accessor functions which call this. In general, the included subclasses should be able to handle being resized, but there's no reason to do so since the system won't be changing its available resolutions at run time.

The default implementation is a no-op if(numLayers==nLayers && numChannels==nChannels)

Reimplemented in BufferedImageGenerator, CDTGenerator, InterleavedYUVGenerator, JPEGGenerator, PNGGenerator, RawCameraGenerator, RegionGenerator, RLEGenerator, and SegmentedColorGenerator.

Definition at line 90 of file FilterBankGenerator.cc.

Referenced by FilterBankGenerator(), refresh(), SegmentedColorGenerator::setNumImages(), RLEGenerator::setNumImages(), RegionGenerator::setNumImages(), RawCameraGenerator::setNumImages(), PNGGenerator::setNumImages(), JPEGGenerator::setNumImages(), InterleavedYUVGenerator::setNumImages(), CDTGenerator::setNumImages(), and BufferedImageGenerator::setNumImages().

void FilterBankGenerator::setDimensions (  )  [protected, virtual]

resets width and height parameters to that of the src

You'll probably want to override this to also set skips and strides

Reimplemented in BufferedImageGenerator, CDTGenerator, InterleavedYUVGenerator, RawCameraGenerator, RLEGenerator, and SegmentedColorGenerator.

Definition at line 127 of file FilterBankGenerator.cc.

Referenced by refresh(), SegmentedColorGenerator::setDimensions(), RLEGenerator::setDimensions(), and InterleavedYUVGenerator::setDimensions().

virtual unsigned char* FilterBankGenerator::createImageCache ( unsigned int  layer,
unsigned int  channel 
) const [protected, pure virtual]

create new image data storage area for the cache - this called by getImage() only when the corresponding entry in images is NULL

You should return the pointer you want stored in images to be returned by any calls to getFirstRow. Interpretation of the data it points to is dependant on the the generator which creates it

Implemented in BufferedImageGenerator, CDTGenerator, InterleavedYUVGenerator, JPEGGenerator, PNGGenerator, RawCameraGenerator, RegionGenerator, RLEGenerator, and SegmentedColorGenerator.

Referenced by getImage().

virtual void FilterBankGenerator::calcImage ( unsigned int  layer,
unsigned int  channel 
) [protected, pure virtual]

should calculate new image data, called by getImage() only when imageValids indicates the image being requested is dirty (and only after getImage() has already called createImageCache())

This is where you'll want to put your user-specific code for calculating the image data

Implemented in BufferedImageGenerator, CDTGenerator, InterleavedYUVGenerator, JPEGGenerator, PNGGenerator, RawCameraGenerator, RegionGenerator, RLEGenerator, and SegmentedColorGenerator.

Referenced by getImage().

bool FilterBankGenerator::refresh (  )  [protected, virtual]

updates the image data to make sure its up to date with what's available from the source

If someone calls getImage on a stage which hadn't been listening for events (an optimization to save time when it doesn't have any listeners of its own -- see EventGeneratorBase), then this will retroactively pull image data from the source even though the event for it was missed

Returns:
false if no image data is available yet, true otherwise

Definition at line 160 of file FilterBankGenerator.cc.

Referenced by getImage(), processEvent(), and refresh().

const FilterBankGenerator& FilterBankGenerator::operator= ( const FilterBankGenerator fbk  )  [private]

don't call


Member Data Documentation

unsigned int FilterBankGenerator::numLayers [protected]

current number of layers available

Definition at line 348 of file FilterBankGenerator.h.

Referenced by RawCameraGenerator::calcImage(), CDTGenerator::calcImage(), RawCameraGenerator::createImageCache(), RLEGenerator::destruct(), RegionGenerator::destruct(), PNGGenerator::destruct(), JPEGGenerator::destruct(), InterleavedYUVGenerator::destruct(), destruct(), BufferedImageGenerator::destruct(), BufferedImageGenerator::downsampleImage(), RegionGenerator::freeCaches(), RawCameraGenerator::freeCaches(), InterleavedYUVGenerator::freeCaches(), freeCaches(), CDTGenerator::freeCaches(), BufferedImageGenerator::freeCaches(), getNumLayers(), InterleavedYUVGenerator::InterleavedYUVGenerator(), InterleavedYUVGenerator::invalidateCaches(), invalidateCaches(), BufferedImageGenerator::invalidateCaches(), JPEGGenerator::JPEGGenerator(), RawCameraGenerator::loadBuffer(), BufferedImageGenerator::loadBuffer(), SegmentedColorGenerator::loadThresholdMap(), PNGGenerator::PNGGenerator(), RawCameraGenerator::processEvent(), CDTGenerator::processEvent(), BufferedImageGenerator::processEvent(), RawCameraGenerator::reconstructImage(), refresh(), RegionGenerator::RegionGenerator(), RLEGenerator::RLEGenerator(), SegmentedColorGenerator::SegmentedColorGenerator(), SegmentedColorGenerator::setDimensions(), RLEGenerator::setDimensions(), RawCameraGenerator::setDimensions(), InterleavedYUVGenerator::setDimensions(), setDimensions(), CDTGenerator::setDimensions(), BufferedImageGenerator::setDimensions(), RLEGenerator::setNumImages(), RegionGenerator::setNumImages(), RawCameraGenerator::setNumImages(), PNGGenerator::setNumImages(), JPEGGenerator::setNumImages(), InterleavedYUVGenerator::setNumImages(), setNumImages(), CDTGenerator::setNumImages(), BufferedImageGenerator::setNumImages(), and RawCameraGenerator::upsampleImage().

unsigned int* FilterBankGenerator::widths [protected]

an array of size numLayers, width (in samples) in pixels of each layer

Definition at line 351 of file FilterBankGenerator.h.

Referenced by BufferedImageGenerator::calcDx(), BufferedImageGenerator::calcDy(), PNGGenerator::calcImage(), JPEGGenerator::calcImage(), BufferedImageGenerator::calcImage(), SegmentedColorGenerator::createImageCache(), PNGGenerator::createImageCache(), JPEGGenerator::createImageCache(), InterleavedYUVGenerator::createImageCache(), BufferedImageGenerator::createImageCache(), destruct(), BufferedImageGenerator::downsampleImage(), SegmentedColorGenerator::getBinSize(), RawCameraGenerator::getBinSize(), PNGGenerator::getBinSize(), JPEGGenerator::getBinSize(), InterleavedYUVGenerator::getBinSize(), getBinSize(), CDTGenerator::getBinSize(), BufferedImageGenerator::getBinSize(), getWidth(), SegmentedColorGenerator::loadBuffer(), RawCameraGenerator::loadBuffer(), InterleavedYUVGenerator::loadBuffer(), loadBuffer(), BufferedImageGenerator::loadBuffer(), RawCameraGenerator::processEvent(), CDTGenerator::processEvent(), BufferedImageGenerator::processEvent(), refresh(), SegmentedColorGenerator::saveBuffer(), RawCameraGenerator::saveBuffer(), InterleavedYUVGenerator::saveBuffer(), saveBuffer(), CDTGenerator::saveBuffer(), BufferedImageGenerator::saveBuffer(), RawCameraGenerator::saveFileStream(), BufferedImageGenerator::saveFileStream(), SegmentedColorGenerator::setDimensions(), RawCameraGenerator::setDimensions(), InterleavedYUVGenerator::setDimensions(), setDimensions(), CDTGenerator::setDimensions(), BufferedImageGenerator::setDimensions(), setNumImages(), RawCameraGenerator::upsampleImage(), and BufferedImageGenerator::upsampleImage().

unsigned int* FilterBankGenerator::heights [protected]

an array of size numLayers, height (in samples) in pixels of each layer

Definition at line 352 of file FilterBankGenerator.h.

Referenced by BufferedImageGenerator::calcDx(), BufferedImageGenerator::calcDy(), PNGGenerator::calcImage(), JPEGGenerator::calcImage(), BufferedImageGenerator::calcImage(), SegmentedColorGenerator::createImageCache(), PNGGenerator::createImageCache(), JPEGGenerator::createImageCache(), InterleavedYUVGenerator::createImageCache(), BufferedImageGenerator::createImageCache(), destruct(), BufferedImageGenerator::downsampleImage(), SegmentedColorGenerator::getBinSize(), RawCameraGenerator::getBinSize(), PNGGenerator::getBinSize(), JPEGGenerator::getBinSize(), InterleavedYUVGenerator::getBinSize(), getBinSize(), CDTGenerator::getBinSize(), BufferedImageGenerator::getBinSize(), getHeight(), SegmentedColorGenerator::loadBuffer(), RawCameraGenerator::loadBuffer(), InterleavedYUVGenerator::loadBuffer(), loadBuffer(), BufferedImageGenerator::loadBuffer(), RawCameraGenerator::processEvent(), CDTGenerator::processEvent(), BufferedImageGenerator::processEvent(), refresh(), SegmentedColorGenerator::saveBuffer(), RawCameraGenerator::saveBuffer(), InterleavedYUVGenerator::saveBuffer(), saveBuffer(), CDTGenerator::saveBuffer(), BufferedImageGenerator::saveBuffer(), RawCameraGenerator::saveFileStream(), BufferedImageGenerator::saveFileStream(), RawCameraGenerator::setDimensions(), setDimensions(), CDTGenerator::setDimensions(), BufferedImageGenerator::setDimensions(), setNumImages(), RawCameraGenerator::upsampleImage(), and BufferedImageGenerator::upsampleImage().

unsigned char*** FilterBankGenerator::images [mutable, protected]

an array [numLayers][numChannels], stores pointer to cached image data

Definition at line 357 of file FilterBankGenerator.h.

Referenced by BufferedImageGenerator::calcDx(), BufferedImageGenerator::calcDy(), SegmentedColorGenerator::calcImage(), RLEGenerator::calcImage(), RegionGenerator::calcImage(), RawCameraGenerator::calcImage(), PNGGenerator::calcImage(), JPEGGenerator::calcImage(), InterleavedYUVGenerator::calcImage(), CDTGenerator::calcImage(), BufferedImageGenerator::calcImage(), BufferedImageGenerator::createImageCache(), destruct(), BufferedImageGenerator::downsampleImage(), RawCameraGenerator::freeCaches(), freeCaches(), CDTGenerator::freeCaches(), RegionGenerator::getBinSize(), getImage(), InterleavedYUVGenerator::invalidateCaches(), BufferedImageGenerator::invalidateCaches(), SegmentedColorGenerator::loadBuffer(), RLEGenerator::loadBuffer(), RegionGenerator::loadBuffer(), RawCameraGenerator::loadBuffer(), PNGGenerator::loadBuffer(), JPEGGenerator::loadBuffer(), InterleavedYUVGenerator::loadBuffer(), BufferedImageGenerator::loadBuffer(), BufferedImageGenerator::processEvent(), RawCameraGenerator::reconstructImage(), SegmentedColorGenerator::saveBuffer(), RLEGenerator::saveBuffer(), RegionGenerator::saveBuffer(), RawCameraGenerator::saveBuffer(), PNGGenerator::saveBuffer(), JPEGGenerator::saveBuffer(), InterleavedYUVGenerator::saveBuffer(), CDTGenerator::saveBuffer(), BufferedImageGenerator::saveBuffer(), RawCameraGenerator::saveFileStream(), BufferedImageGenerator::saveFileStream(), setNumImages(), RawCameraGenerator::upsampleImage(), and BufferedImageGenerator::upsampleImage().

bool** FilterBankGenerator::imageValids [mutable, protected]

an array [numLayers][numChannels], entry is true if cached data is still valid

Definition at line 358 of file FilterBankGenerator.h.

Referenced by BufferedImageGenerator::calcDx(), BufferedImageGenerator::calcDxDy(), BufferedImageGenerator::calcDy(), SegmentedColorGenerator::calcImage(), RLEGenerator::calcImage(), RegionGenerator::calcImage(), RawCameraGenerator::calcImage(), PNGGenerator::calcImage(), JPEGGenerator::calcImage(), InterleavedYUVGenerator::calcImage(), CDTGenerator::calcImage(), InterleavedYUVGenerator::createImageCache(), destruct(), BufferedImageGenerator::downsampleImage(), RawCameraGenerator::freeCaches(), CDTGenerator::freeCaches(), RLEGenerator::getBinSize(), RegionGenerator::getBinSize(), getImage(), getImageCached(), RLEGenerator::getNumRuns(), InterleavedYUVGenerator::invalidateCaches(), invalidateCaches(), BufferedImageGenerator::invalidateCaches(), SegmentedColorGenerator::loadBuffer(), RLEGenerator::loadBuffer(), RegionGenerator::loadBuffer(), RawCameraGenerator::loadBuffer(), PNGGenerator::loadBuffer(), JPEGGenerator::loadBuffer(), InterleavedYUVGenerator::loadBuffer(), BufferedImageGenerator::loadBuffer(), BufferedImageGenerator::processEvent(), SegmentedColorGenerator::saveBuffer(), RLEGenerator::saveBuffer(), RegionGenerator::saveBuffer(), RawCameraGenerator::saveBuffer(), PNGGenerator::saveBuffer(), JPEGGenerator::saveBuffer(), InterleavedYUVGenerator::saveBuffer(), CDTGenerator::saveBuffer(), BufferedImageGenerator::saveBuffer(), RawCameraGenerator::saveFileStream(), BufferedImageGenerator::saveFileStream(), setNumImages(), and BufferedImageGenerator::upsampleImage().

unsigned int FilterBankGenerator::frameNumber [protected]

the frame number of last frame received by processEvent - subclasses will need to set to the source's frameNumber if they don't call FilterBankGenerator::processEvent()

The idea is to use this as a unique serial number for each frame. That way you can know if the current image in different generators is actually the same camera image before you try to compare or combine them.

You could also figure out the number of dropped frames by subtracting framesProcessed from this value. Give some leeway however, because it takes the first 40-70 frames just to boot up (when running on the aibo), so there's no way they can be processed.

Definition at line 375 of file FilterBankGenerator.h.

Referenced by getFrameNumber(), RawCameraGenerator::processEvent(), CDTGenerator::processEvent(), BufferedImageGenerator::processEvent(), and refresh().

unsigned int FilterBankGenerator::sysFrameNumber = -1U [static, protected]

the current frame number available from the system - subclasses which receive data directly from the system should set this (and should not use EventGeneratorBase's auto-listen to ensure this is accurate)

Definition at line 378 of file FilterBankGenerator.h.

Referenced by RawCameraGenerator::processEvent(), CDTGenerator::processEvent(), BufferedImageGenerator::processEvent(), and refresh().

unsigned int FilterBankGenerator::framesProcessed [protected]

subclasses should increment this any time they make a new filter bank available

this is automatically incremented if you use the FilterBankGenerator::processEvent()

Definition at line 382 of file FilterBankGenerator.h.

Referenced by getFramesProcessed(), RawCameraGenerator::processEvent(), CDTGenerator::processEvent(), BufferedImageGenerator::processEvent(), and refresh().


The documentation for this class was generated from the following files:

Tekkotsu v4.0
Generated Thu Nov 22 00:58:25 2007 by Doxygen 1.5.4