Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

RegionGenerator Class Reference

Connects regions of CMVision format runs in RLEGenerator. More...

#include <RegionGenerator.h>

Inheritance diagram for RegionGenerator:

Detailed Description

Connects regions of CMVision format runs in RLEGenerator.

Uses the CMVision library for main processing.

getImage() will return an array of RegionGenerator::region_stats - one entry per color. This will give you some statistics on colors present, as well as the head of a linked list through regions of each color in the image.

Uses fields in the RLEGenerator's runs to store region information. This means we don't have to make an extra copy of the data, but unfortunately also means these two stages are tightly coupled...

Similarly, this also accesses the color information of the runs, so the events received must be a SegmentedColorFilterBankEvents so that it can interpret the color information. Some statistical information will then be stored in the color struct to report the min region area, max region area, and number of regions.

Definition at line 30 of file RegionGenerator.h.

List of all members.

Public Types

typedef CMVision::region region
 using the CMVision library's region information
typedef CMVision::color_class_state region_stats
 using the CMVision library's color struct to store the region info

Public Member Functions

 RegionGenerator (unsigned int mysid, RLEGenerator *rleg, EventBase::EventTypeID_t tid)
 constructor
virtual ~RegionGenerator ()
 destructor
virtual void freeCaches ()
 deletes storage of cached images and marks it invalid
virtual void doEvent ()
 see class notes above for what data this can handle
virtual unsigned int getBinSize () const
virtual unsigned int loadBuffer (const char buf[], unsigned int len, const char *filename=NULL)
virtual unsigned int saveBuffer (char buf[], unsigned int len) const
virtual size_t getImageSize (unsigned int, unsigned int) const
 returns the number of bytes used for the data returned by getImage() - if the data varies in size (e.g. jpeg compression), will return 0 if the image hasn't been calculated yet (so call it after getImage())

Static Public Member Functions

static std::string getClassDescription ()
 Gives a short description of what this class of behaviors does... you should override this (but don't have to).

Protected Types

typedef
SegmentedColorFilterBankEvent::color_class_state 
color_class_state
 use the same color info as SegmentedColorFilterBankEvent (since that's what's supplying the color info)

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 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)
 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 srcNumColors
 number of colors available (from src->src, which should be SegmentedColorGenerator...)
const color_class_statesrcColors
 colors information (from src->src, which should be SegmentedColorGenerator...)
region *** regions
 data storage for region information

Static Protected Attributes

static const unsigned int MAX_REGIONS = 640*480/16
 maximum number of regions, value is from historical Vision sources

Private Member Functions

 RegionGenerator (const RegionGenerator &fbk)
 don't call
const RegionGeneratoroperator= (const RegionGenerator &fbk)
 don't call

Member Typedef Documentation

use the same color info as SegmentedColorFilterBankEvent (since that's what's supplying the color info)

Definition at line 58 of file RegionGenerator.h.

using the CMVision library's region information

Definition at line 32 of file RegionGenerator.h.

using the CMVision library's color struct to store the region info

Definition at line 33 of file RegionGenerator.h.


Constructor & Destructor Documentation

RegionGenerator::RegionGenerator ( unsigned int  mysid,
RLEGenerator rleg,
EventBase::EventTypeID_t  tid 
)

constructor

Definition at line 11 of file RegionGenerator.cc.

virtual RegionGenerator::~RegionGenerator (  )  [virtual]

destructor

Definition at line 39 of file RegionGenerator.h.

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

don't call


Member Function Documentation

void RegionGenerator::calcImage ( unsigned int  layer,
unsigned int  channel 
) [protected, 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

Implements FilterBankGenerator.

Definition at line 209 of file RegionGenerator.cc.

unsigned char * RegionGenerator::createImageCache ( unsigned int  layer,
unsigned int  channel 
) 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 194 of file RegionGenerator.cc.

Referenced by loadBuffer().

void RegionGenerator::destruct (  )  [protected, virtual]

deletes the arrays

Reimplemented from FilterBankGenerator.

Definition at line 230 of file RegionGenerator.cc.

Referenced by ~RegionGenerator().

void RegionGenerator::doEvent (  )  [virtual]

see class notes above for what data this can handle

Reimplemented from FilterBankGenerator.

Definition at line 37 of file RegionGenerator.cc.

void RegionGenerator::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 from FilterBankGenerator.

Definition at line 27 of file RegionGenerator.cc.

Referenced by doEvent(), loadBuffer(), and ~RegionGenerator().

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

The loadBuffer() functions of the included subclasses aren't tested, so don't assume they'll work without a little debugging...

Reimplemented from FilterBankGenerator.

Definition at line 63 of file RegionGenerator.cc.

static std::string RegionGenerator::getClassDescription (  )  [static]

Gives a short description of what this class of behaviors does... you should override this (but don't have to).

If you do override this, also consider overriding getDescription() to return it

Reimplemented from BehaviorBase.

Definition at line 44 of file RegionGenerator.h.

virtual size_t RegionGenerator::getImageSize ( unsigned int  layer,
unsigned int   
) const [virtual]

returns the number of bytes used for the data returned by getImage() - if the data varies in size (e.g. jpeg compression), will return 0 if the image hasn't been calculated yet (so call it after getImage())

Reimplemented from FilterBankGenerator.

Definition at line 55 of file RegionGenerator.h.

unsigned int RegionGenerator::loadBuffer ( const char  buf[],
unsigned int  len,
const char *  filename = NULL 
) [virtual]

The loadBuffer() functions of the included subclasses aren't tested, so don't assume they'll work without a little debugging...

Reimplemented from FilterBankGenerator.

Definition at line 86 of file RegionGenerator.cc.

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

don't call

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

The loadBuffer() functions of the included subclasses aren't tested, so don't assume they'll work without a little debugging...

Reimplemented from FilterBankGenerator.

Definition at line 139 of file RegionGenerator.cc.

Referenced by RegionCam::writeRegions().

void RegionGenerator::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 181 of file RegionGenerator.cc.

Referenced by RegionGenerator().


Member Data Documentation

const unsigned int RegionGenerator::MAX_REGIONS = 640*480/16 [static, protected]

maximum number of regions, value is from historical Vision sources

Definition at line 59 of file RegionGenerator.h.

Referenced by calcImage(), createImageCache(), getBinSize(), and loadBuffer().

data storage for region information

Definition at line 68 of file RegionGenerator.h.

Referenced by calcImage(), createImageCache(), destruct(), freeCaches(), loadBuffer(), and setNumImages().

colors information (from src->src, which should be SegmentedColorGenerator...)

Definition at line 67 of file RegionGenerator.h.

Referenced by createImageCache(), doEvent(), and RegionGenerator().

unsigned int RegionGenerator::srcNumColors [protected]

number of colors available (from src->src, which should be SegmentedColorGenerator...)

Definition at line 66 of file RegionGenerator.h.

Referenced by calcImage(), createImageCache(), doEvent(), getBinSize(), loadBuffer(), RegionGenerator(), and saveBuffer().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:15 2016 by Doxygen 1.6.3