Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
#include <RLEGenerator.h>
Inheritance diagram for RLEGenerator:
Uses the CMVision library for main processing.
The RLE produced isn't quite optimal in terms of size. To make it easier to directly process the RLE for recognition tasks, each run will be broken at the end of the row. So a solid image will still contain height runs instead of just one.
Also, the run structures contain extra fields to be used for region connecting. These fields aren't sent over wireless, and are filled in by the RegionGenerator. I don't necessarily like the tight coupling between the RLE and Region Generators that this requires, but it saves a copy of the data and allows us to use CMVision instead of rewriting.
Note that since the amount of data for each row is variable (depends on the complexity of that row) the row stride and skip are useless. You'll have to process the RLE yourself to find a given index.
If the incoming events is a SegmentedColorFilterBankEvents, then it will post a SegmentedColorFilterBank to retain additional color information. If the event is of a different format, it will post a regular FilterBankEvent.
Note that although you could hook this class up to a raw intensity image, it is primarily of use with segmented color images because it doesn't handle gradients or noise well at all - this type of encoding/compression assumes cartoonish images of large blocks of flat color. However, if you have some kind of other preprocessing that also provides suitable data, this can encode it for you.
Definition at line 43 of file RLEGenerator.h.
Public Types | |
typedef uchar | cmap_t |
the type to use for a color index | |
typedef CMVision::run< cmap_t > | run |
use the CMVision library's run structure | |
Public Member Functions | |
RLEGenerator (EventBase::EventGeneratorID_t gid, unsigned int sid, unsigned int mysid) | |
constructor | |
virtual | ~RLEGenerator () |
destructor | |
virtual void | processEvent (const EventBase &event) |
should receive FilterBankEvents from any standard format FilterBankGenerator (like RawCameraGenerator) | |
virtual unsigned int | getBinSize () const |
calculates space needed to save - if you can't precisely add up the size, 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. | |
virtual unsigned int | getNumRuns (unsigned int layer, unsigned int chan) const |
returns the number of runs for the image | |
virtual const run * | getRuns (unsigned int layer, unsigned int chan) const |
returns the actual runs of the specified image | |
virtual const run & | getRun (unsigned int layer, unsigned int chan, unsigned int i) const |
returns a specific run of the specified image | |
virtual FilterBankGenerator * | getSourceGenerator () const |
returns the generator this is receiving its events from (or the last one anyway) | |
Static Public Member Functions | |
std::string | getClassDescription () |
Gives a short description of what this class of behaviors does... you should override this (but don't have to). | |
Protected Member Functions | |
virtual void | setDimensions () |
sets the width, height, skip and stride, as well as maxRuns | |
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 unsigned char * | createImageCache (unsigned int layer, unsigned int chan) const |
create new image data storage area for the cache - this is only called when the corresponding entry in images is NULL | |
virtual void | calcImage (unsigned int layer, unsigned int chan) const |
should calculate new image data, only called when imageValids indicates the image being requested is dirty | |
virtual void | destruct () |
deletes the arrays | |
unsigned int | calcExpMaxRuns (unsigned int layer) const |
uses a heuristic to predict the maximum number of runs expected per layer | |
Protected Attributes | |
FilterBankGenerator * | src |
the generator of the last FilterBankEvent received | |
unsigned int ** | numRuns |
a matrix of ints, holds the number of used runs for each image | |
unsigned int * | maxRuns |
the maximum number of runs possible for each layer | |
Static Protected Attributes | |
const unsigned int | MIN_EXP_RUN_LENGTH = 8 |
The expected minimum average length of each run. | |
const unsigned int | XMIT_BYTES_PER_RUN = sizeof(cmap_t)+sizeof(short)+sizeof(short) |
number of bytes needed to send each run | |
Private Member Functions | |
RLEGenerator (const RLEGenerator &fbk) | |
don't call | |
const RLEGenerator & | operator= (const RLEGenerator &fbk) |
don't call |
|
the type to use for a color index
Definition at line 45 of file RLEGenerator.h. |
|
use the CMVision library's run structure
Definition at line 46 of file RLEGenerator.h. Referenced by RegionGenerator::calcImage(), createImageCache(), getRun(), getRuns(), LoadBuffer(), and SaveBuffer(). |
|
constructor
Definition at line 9 of file RLEGenerator.cc. |
|
destructor
Definition at line 15 of file RLEGenerator.cc. |
|
don't call
|
|
uses a heuristic to predict the maximum number of runs expected per layer
Definition at line 82 of file RLEGenerator.h. Referenced by setDimensions(), and setNumImages(). |
|
should calculate new image data, only called when imageValids indicates the image being requested is dirty This is where you'll want to put your user-specific code for calculating the image data Implements FilterBankGenerator. Definition at line 141 of file RLEGenerator.cc. |
|
create new image data storage area for the cache - this is only called 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 Implements FilterBankGenerator. Definition at line 136 of file RLEGenerator.cc. Referenced by LoadBuffer(). |
|
deletes the arrays
Reimplemented from FilterBankGenerator. Definition at line 148 of file RLEGenerator.cc. Referenced by ~RLEGenerator(). |
|
calculates space needed to save - if you can't precisely add up the size, overestimate and things will still work.
Reimplemented from FilterBankGenerator. Definition at line 39 of file RLEGenerator.cc. |
|
Gives a short description of what this class of behaviors does... you should override this (but don't have to).
Reimplemented from BehaviorBase. Definition at line 53 of file RLEGenerator.h. |
|
returns the number of runs for the image
Definition at line 63 of file RLEGenerator.h. Referenced by RegionGenerator::calcImage(). |
|
returns a specific run of the specified image
Definition at line 67 of file RLEGenerator.h. |
|
returns the actual runs of the specified image
Definition at line 65 of file RLEGenerator.h. |
|
returns the generator this is receiving its events from (or the last one anyway)
Definition at line 70 of file RLEGenerator.h. Referenced by SegCamBehavior::writeRLE(). |
|
this isn't really tested, don't rely on it working without a little debugging... specifically, doesn't set parent or next fields Reimplemented from FilterBankGenerator. Definition at line 52 of file RLEGenerator.cc. |
|
don't call
|
|
should receive FilterBankEvents from any standard format FilterBankGenerator (like RawCameraGenerator)
Reimplemented from FilterBankGenerator. Definition at line 21 of file RLEGenerator.cc. |
|
Save to a given buffer.
Reimplemented from FilterBankGenerator. Definition at line 91 of file RLEGenerator.cc. Referenced by SegCamBehavior::writeRLE(). |
|
sets the width, height, skip and stride, as well as maxRuns
Definition at line 116 of file RLEGenerator.cc. Referenced by processEvent(). |
|
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. Reimplemented from FilterBankGenerator. Definition at line 125 of file RLEGenerator.cc. Referenced by processEvent(), and RLEGenerator(). |
|
the maximum number of runs possible for each layer
Definition at line 87 of file RLEGenerator.h. Referenced by calcImage(), createImageCache(), destruct(), getBinSize(), LoadBuffer(), setDimensions(), and setNumImages(). |
|
The expected minimum average length of each run.
Definition at line 73 of file RLEGenerator.h. Referenced by calcExpMaxRuns(). |
|
a matrix of ints, holds the number of used runs for each image
Definition at line 86 of file RLEGenerator.h. Referenced by calcImage(), destruct(), getBinSize(), getNumRuns(), LoadBuffer(), SaveBuffer(), and setNumImages(). |
|
the generator of the last FilterBankEvent received
Definition at line 84 of file RLEGenerator.h. Referenced by calcImage(), getSourceGenerator(), processEvent(), and setDimensions(). |
|
number of bytes needed to send each run
Definition at line 74 of file RLEGenerator.h. Referenced by getBinSize(). |
Tekkotsu v2.0 |
Generated Wed Jan 21 03:23:24 2004 by Doxygen 1.3.4 |