CDTGenerator Class Reference#include <CDTGenerator.h>
Inheritance diagram for CDTGenerator:
[legend]List of all members.
Detailed Description
Generates SegmentedColorFilterBankEvents with images provided from the system.
The Aibo has hardware-level color segmentation based on rectangular regions of UV color space. This less flexible than the CMVision segmentation routines, which allow arbitrary shapes in color space, but the CDT (Color Detection Table) implementation has the major advantage of being done in hardware.
This class doesn't do any processing of its own, it simply provides access to the CDT segmented images generated by the system.
To use this, you will first have to send the system the color regions that define the CDT. You'll need to look in the OPEN-R documentation regarding the OCdtVectorData data structure and the New/Set/DeleteCdtVectorData() functions.
For now, the color information in the Segmented Color Events will be NULL, so you won't be able to connect it to the rest of the CMVision stages unless you fill it in. Filling in the color information will require modifications of this source - I'm consciously cutting some corners to get this out the door sooner. Hopefully someone who needs this capability can pick up where I left off. It would be nice if someone made a version of CMVision's .col file format which also held the CDT information so the whole thing could be set up with one file load.
Only the actual layers sent by the system will be referenced - no double resolution layer. Much like RawCameraGenerator, the extra subsampled images are simply using a larger interleave value. If you want the images in continuous memory, you'll need to pass this through a de-interleaver stage.
Only one channel is available.
Definition at line 44 of file CDTGenerator.h.
|
Public Types |
enum | channel_id_t { CHAN_CDT,
NUM_CHANNELS
} |
| holds id values for specifying image channel/bands More...
|
Public Member Functions |
| CDTGenerator (unsigned int numRawLayers, unsigned int numCalcLayers, EventBase::EventGeneratorID_t gid, unsigned int sid, unsigned int mysid) |
| constructor
|
virtual | ~CDTGenerator () |
| destructor
|
virtual void | processEvent (const EventBase &event) |
| called with system's image info
|
virtual void | freeCaches () |
| the memory for all layers was allocated by system, so we just set them to NULL before calling FilterBankGenerator::freeCaches() so it won't try to delete them
|
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.
|
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 | 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 the current width, height, stride, and skip for all of the layers
|
virtual unsigned char * | createImageCache (unsigned int layer, unsigned int chan) const |
| 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 chan) const |
| 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
|
Protected Attributes |
unsigned int | numRealLayers |
| the number of actual layers to expect from the system
|
unsigned char ** | layers |
| an array of pointers to actual system memory for each layer
|
const OFbkImageInfo ** | imageInfos |
| information about image properties
|
Private Member Functions |
| CDTGenerator (const CDTGenerator &fbk) |
| don't call
|
const CDTGenerator & | operator= (const CDTGenerator &fbk) |
| don't call
|
Member Enumeration Documentation
|
holds id values for specifying image channel/bands
- Enumeration values:
-
CHAN_CDT |
Color Detection Table, segmented image. |
NUM_CHANNELS |
number of channels per resolution layer |
Definition at line 58 of file CDTGenerator.h. |
Constructor & Destructor Documentation
CDTGenerator::CDTGenerator |
( |
unsigned int |
numRawLayers, |
|
|
unsigned int |
numCalcLayers, |
|
|
EventBase::EventGeneratorID_t |
gid, |
|
|
unsigned int |
sid, |
|
|
unsigned int |
mysid |
|
) |
|
|
CDTGenerator::CDTGenerator |
( |
const CDTGenerator & |
fbk |
) |
[private] |
|
Member Function Documentation
void CDTGenerator::calcImage |
( |
unsigned int |
layer, |
|
|
unsigned int |
chan |
|
) |
const [protected, virtual] |
|
unsigned char * CDTGenerator::createImageCache |
( |
unsigned int |
layer, |
|
|
unsigned int |
chan |
|
) |
const [protected, 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
Implements FilterBankGenerator.
Definition at line 166 of file CDTGenerator.cc. |
void CDTGenerator::destruct |
( |
|
) |
[protected, virtual] |
|
void CDTGenerator::freeCaches |
( |
|
) |
[virtual] |
|
unsigned int CDTGenerator::getBinSize |
( |
|
) |
const [virtual] |
|
|
calculates space needed to save - if you can't precisely add up the size, overestimate and things will still work.
- Returns:
- number of bytes read/written, 0 if error (or empty)
Reimplemented from FilterBankGenerator.
Definition at line 67 of file CDTGenerator.cc. |
std::string CDTGenerator::getClassDescription |
( |
|
) |
[inline, static] |
|
|
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 55 of file CDTGenerator.h. |
unsigned int CDTGenerator::LoadBuffer |
( |
const char |
buf[], |
|
|
unsigned int |
len |
|
) |
[virtual] |
|
void CDTGenerator::processEvent |
( |
const EventBase & |
event |
) |
[virtual] |
|
|
called with system's image info
The const casts in this function are regretable but necessary since the OPEN-R OFbkImage constructor requires mutable arguments, even though it shouldn't be modifying the data
Reimplemented from FilterBankGenerator.
Definition at line 25 of file CDTGenerator.cc. |
unsigned int CDTGenerator::SaveBuffer |
( |
char |
buf[], |
|
|
unsigned int |
len |
|
) |
const [virtual] |
|
|
Save to a given buffer.
- Parameters:
-
| buf | pointer to the memory where you should begin writing |
| len | length of buf available. (this isn't all yours, constrain yourself to what you returned in getBinSize() ) |
- Returns:
- the number of bytes actually used
Reimplemented from FilterBankGenerator.
Definition at line 84 of file CDTGenerator.cc. |
void CDTGenerator::setDimensions |
( |
|
) |
[protected, virtual] |
|
void CDTGenerator::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 from FilterBankGenerator.
Definition at line 150 of file CDTGenerator.cc.
Referenced by CDTGenerator(). |
Member Data Documentation
|
the number of actual layers to expect from the system
Definition at line 85 of file CDTGenerator.h. |
The documentation for this class was generated from the following files:
|