Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
SegmentedColorGenerator Class Reference#include <SegmentedColorGenerator.h>
Inheritance diagram for SegmentedColorGenerator:
![]() Detailed DescriptionGenerates FilterBankEvents indexed color images based on a color threshold file.Pretty simple idea - use a big mapping of YUV values to lookup index values. Threshold files are 16x64x64 = 64KB. So each Y component is discretized into 16 levels, U and V into 64 each. Then the appropriate element of the 3D matrix is looked up, which holds the desired index for that color. The threshold files are generated offline. See http://www.tekkotsu.org/CameraSetup.html The color information is shared for all threshold files in this object. The row skip is always 0, and the row stride is always width. But it would be better to use the proper accessor functions to be more general. Should receive FilterBankEvents from any standard format FilterBankGenerator (like RawCameraGenerator) However, images that use an increment!=1 will break. The events which are produced are SegmentedColorFilterBankEvents, which will allow you to reference the color information later on. Keep in mind that the region and area statistic fields are not filled out at this stage... the RegionGenerator will complete the processing if you want that info as well. Uses the CMVision library for main processing The format used for serialization is: (code is in saveBuffer())
For more information on serialization, see FilterBankGenerator Definition at line 53 of file SegmentedColorGenerator.h.
Member Typedef Documentation
a shorthand for the hash structure that CMVision expects for the color lookups
Definition at line 57 of file SegmentedColorGenerator.h.
Constructor & Destructor Documentation
constructor, you can pass which channels to use as Y, U, & V channels
Definition at line 20 of file SegmentedColorGenerator.cc.
don't call
Member Function Documentation
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 66 of file SegmentedColorGenerator.h.
should receive FilterBankEvents from any standard format FilterBankGenerator (like RawCameraGenerator)
Reimplemented from FilterBankGenerator. Definition at line 44 of file SegmentedColorGenerator.cc.
loads a threshold map into memory from a file, returns -1U if failed, otherwise returns corresponding channel
Definition at line 57 of file SegmentedColorGenerator.cc.
loads color information from a file, returns false if failed, true otherwise
Definition at line 79 of file SegmentedColorGenerator.cc.
returns the number of different colors available
Definition at line 78 of file SegmentedColorGenerator.h. Referenced by ProjectInterface::defLookupNumColors(), getColorIndex(), and processEvent().
gives direct access to the color information
Definition at line 81 of file SegmentedColorGenerator.h. Referenced by getColorName(), getColorRGB(), and processEvent().
gives direct access to the color information
Definition at line 84 of file SegmentedColorGenerator.h.
returns index of color corresponding to a string (uses a fast hash lookup), or -1U if not found
Definition at line 87 of file SegmentedColorGenerator.h. Referenced by ProjectInterface::defLookupColorIndexByName(), ProjectInterface::defLookupColorIndexByRgb(), getColorIndex(), and getColorRGB().
returns index of color corresponding to a string (uses a fast hash lookup), or -1U if not found
Definition at line 94 of file SegmentedColorGenerator.h.
returns index of color corresponding to a specific rgb color, or -1U if not found
Definition at line 97 of file SegmentedColorGenerator.h.
returns rgb struct (from colors.h) corresponding to an int index. Returns black if index is invalid.
Definition at line 106 of file SegmentedColorGenerator.h. Referenced by ProjectInterface::defLookupColorRGB(), getColorIndex(), and getColorRGB().
returns rgb struct (from colors.h) corresponding to a string. Returns black if index is invalid.
Definition at line 111 of file SegmentedColorGenerator.h.
returns rgb struct (from colors.h) corresponding to a string. Returns black if index is invalid.
Definition at line 116 of file SegmentedColorGenerator.h.
returns the name of a color given its index
Definition at line 121 of file SegmentedColorGenerator.h. Referenced by ProjectInterface::defLookupColorName().
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.
Reimplemented from FilterBankGenerator. Definition at line 106 of file SegmentedColorGenerator.cc.
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 114 of file SegmentedColorGenerator.cc.
Save to a given buffer in memory.
Reimplemented from FilterBankGenerator. Definition at line 142 of file SegmentedColorGenerator.cc.
in case you want to only save the color info but not the image (this is binary - *not* the same format as what's read in loadColorInfo)
Definition at line 172 of file SegmentedColorGenerator.cc. Referenced by saveBuffer(), RegionCamBehavior::writeRegions(), and SegCamBehavior::writeRLE().
in case you want to only load the color info but not the image (this is binary - *not* the same format as what's read in loadColorInfo)
Definition at line 183 of file SegmentedColorGenerator.cc. Referenced by loadBuffer().
ignores nChannels - the number of channels is always the number of loaded threshold maps
Reimplemented from FilterBankGenerator. Definition at line 201 of file SegmentedColorGenerator.cc. Referenced by loadThresholdMap(), and SegmentedColorGenerator().
sets stride parameter to width (as set by FilterBankGenerator::setDimensions()) Reimplemented from FilterBankGenerator. Definition at line 194 of file SegmentedColorGenerator.cc.
creates the image cache width[layer]*height[layer] + 1 -- why plus one? Because CMVision temporarily scribbles one-past end of each row
Implements FilterBankGenerator. Definition at line 206 of file SegmentedColorGenerator.cc. Referenced by loadBuffer().
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 214 of file SegmentedColorGenerator.cc.
don't call
Member Data Documentation
bits of discretization for Y channel in the threshold map
Definition at line 140 of file SegmentedColorGenerator.h. Referenced by calcImage(), and loadThresholdMap().
bits of discretization for U channel in the threshold map
Definition at line 141 of file SegmentedColorGenerator.h. Referenced by calcImage(), and loadThresholdMap().
bits of discretization for V channel in the threshold map
Definition at line 142 of file SegmentedColorGenerator.h. Referenced by calcImage(), and loadThresholdMap().
levels of discretization for Y channel in the threshold map
Definition at line 143 of file SegmentedColorGenerator.h. Referenced by loadColorInfo(), and loadThresholdMap().
levels of discretization for U channel in the threshold map
Definition at line 144 of file SegmentedColorGenerator.h. Referenced by loadColorInfo(), and loadThresholdMap().
levels of discretization for V channel in the threshold map
Definition at line 145 of file SegmentedColorGenerator.h. Referenced by loadColorInfo(), and loadThresholdMap().
maximum number of different colors that can be segmented
Definition at line 146 of file SegmentedColorGenerator.h. Referenced by loadColorInfo().
the channel of the source's Y channel
Definition at line 155 of file SegmentedColorGenerator.h. Referenced by calcImage().
the channel of the source's U channel
Definition at line 156 of file SegmentedColorGenerator.h. Referenced by calcImage().
the channel of the source's V channel
Definition at line 157 of file SegmentedColorGenerator.h. Referenced by calcImage().
list of threshold maps so you can segment the same source different ways
Definition at line 159 of file SegmentedColorGenerator.h. Referenced by calcImage(), loadColorInfo(), loadThresholdMap(), setNumImages(), and ~SegmentedColorGenerator().
filename of each tmap;
Definition at line 160 of file SegmentedColorGenerator.h. Referenced by loadColorInfo(), and loadThresholdMap().
number of available colors
Definition at line 162 of file SegmentedColorGenerator.h. Referenced by decodeColorsInc(), encodeColorsInc(), getColorName(), getColorRGB(), getNumColors(), loadColorInfo(), and loadThresholdMap().
array of available colors
Definition at line 163 of file SegmentedColorGenerator.h. Referenced by decodeColorsInc(), encodeColorsInc(), getColors(), and loadColorInfo().
look up color indexes corresponding to names
Definition at line 164 of file SegmentedColorGenerator.h. Referenced by getColorIndex(), loadColorInfo(), processEvent(), and ~SegmentedColorGenerator().
The documentation for this class was generated from the following files: |
Tekkotsu v4.0 |
Generated Thu Nov 22 00:58:40 2007 by Doxygen 1.5.4 |