Fawkes API
Fawkes Development Version
|
#include <>>
Public Member Functions | |
YuvColormap (unsigned int depth=1, unsigned int width=256, unsigned int height=256) | |
Constructor. More... | |
YuvColormap (const char *shmem_lut_id, unsigned int depth=1, unsigned int width=256, unsigned int height=256) | |
Constructor. More... | |
YuvColormap (const char *shmem_lut_id, bool destroy_on_free, unsigned int depth=1, unsigned int width=256, unsigned int height=256) | |
Constructor. More... | |
YuvColormap (YuvColormap *cm, const char *shmem_lut_id, bool destroy_on_free=false) | |
Constructor. More... | |
YuvColormap (const YuvColormap &cm) | |
Copy constructor. More... | |
virtual | ~YuvColormap () |
Destructor. More... | |
virtual color_t | determine (unsigned int y, unsigned int u, unsigned int v) const |
Determine color class for given YUV value. More... | |
virtual void | set (unsigned int y, unsigned int u, unsigned int v, color_t c) |
Set color class for given YUV value. More... | |
virtual void | reset () |
Reset colormap. More... | |
virtual void | set (unsigned char *buffer) |
Set to the given raw buffer. More... | |
virtual size_t | size () |
Size in bytes of buffer returned by get_buffer(). More... | |
virtual unsigned char * | get_buffer () const |
Get the raw buffer of this colormap. More... | |
virtual Colormap & | operator+= (const Colormap &cmlt) |
Adds the given colormap to this colormap. More... | |
virtual Colormap & | operator+= (const char *filename) |
Convenience method for the method above. More... | |
virtual Colormap & | operator= (const YuvColormap &yuvcm) |
Assign operation. More... | |
virtual unsigned int | width () const |
Get width of colormap. More... | |
virtual unsigned int | height () const |
Get height of colormap. More... | |
virtual unsigned int | depth () const |
Get depth of colormap. More... | |
virtual unsigned int | deepness () const |
Get deepness of colormap. More... | |
unsigned int | plane_size () const |
Get U/V plane size. More... | |
virtual std::list< ColormapFileBlock * > | get_blocks () |
Get file blocks for this colormap. More... | |
void | copy_uvplane (unsigned char *uvplane, unsigned int level) |
Copy single U/V plane. More... | |
void | replace_color (color_t from, color_t to) |
Replace a given color with another one. More... | |
![]() | |
virtual | ~Colormap () |
Virtual empty destructor. More... | |
virtual void | to_image (unsigned char *yuv422_planar_buffer, unsigned int level=0) |
Create image from LUT. More... | |
virtual unsigned int | image_height () const |
Height of conversion image. More... | |
virtual unsigned int | image_width () const |
Width of conversion image. More... | |
YUV Colormap.
This class is the implementation of a 3D YUV colormap. The U/V planes are always sampled in full. In general for colormaps we assume that in many cases the luminance can be ignored completely. This allows for small datasets with speedy access and sufficient discriminatory power. However, in some situations this is not enough. In that case you can give a depth for the Y value. The Y axis is then separated in the given number of ranges, each range is a stacked complete U/V plane. Note, only depth values where depth = 2^n, n from natural numbers holds will provide with equal ranges. Other values will lead to one bigger range, being the one with the highest Y values which will be filled with the whole rest.
You can see such a colormap as a colormap that consists of UV planes that represent a certain Y range stacked on top of each other.
firevision::YuvColormap::YuvColormap | ( | unsigned int | depth = 1 , |
unsigned int | width = 256 , |
||
unsigned int | height = 256 |
||
) |
firevision::YuvColormap::YuvColormap | ( | const char * | shmem_lut_id, |
unsigned int | depth = 1 , |
||
unsigned int | width = 256 , |
||
unsigned int | height = 256 |
||
) |
firevision::YuvColormap::YuvColormap | ( | const char * | shmem_lut_id, |
bool | destroy_on_free, | ||
unsigned int | depth = 1 , |
||
unsigned int | width = 256 , |
||
unsigned int | height = 256 |
||
) |
firevision::YuvColormap::YuvColormap | ( | YuvColormap * | cm, |
const char * | shmem_lut_id, | ||
bool | destroy_on_free = false |
||
) |
Constructor.
Creates a colormap in shared memory for the given LUT ID and copies the data of the given existing colormap.
cm | existing colormap to copy data from |
shmem_lut_id | shared memory LUT ID |
destroy_on_free | true to delete the shared memory segment to delete, false to keep the segment |
firevision::YuvColormap::YuvColormap | ( | const YuvColormap & | cm | ) |
|
virtual |
void firevision::YuvColormap::copy_uvplane | ( | unsigned char * | uvplane, |
unsigned int | level | ||
) |
Copy single U/V plane.
This will copy the given U/V plane to the given level in this colormap.
uvplane | buffer of U/V plane to copy |
level | level to copy the plane to |
OutOfBoundsException | thrown if level > depth() |
Definition at line 243 of file yuvcm.cpp.
Referenced by firevision::ColormapFile::get_colormap().
|
virtual |
Get deepness of colormap.
The deepness is the maximum value of depth().
Implements firevision::Colormap.
Definition at line 342 of file yuvcm.cpp.
Referenced by firevision::BayesHistosToLut::calculateLutAllColors(), firevision::BayesHistosToLut::calculateLutValues(), and firevision::ColormapFileYuvBlock::ColormapFileYuvBlock().
|
virtual |
Get depth of colormap.
Implements firevision::Colormap.
Definition at line 336 of file yuvcm.cpp.
Referenced by firevision::BayesHistosToLut::calculateLutAllColors(), firevision::BayesHistosToLut::calculateLutValues(), firevision::ColormapFileYuvBlock::ColormapFileYuvBlock(), ColorTrainWidget::load_histograms(), ColorTrainWidget::save_colormap(), FuseTransferWidget::set_current_colormap(), and YuvColormap().
|
inlinevirtual |
Determine color class for given YUV value.
y | Y value from YUV colorspace |
u | U value from YUV colorspace |
v | V value from YUV colorspace |
Implements firevision::Colormap.
Definition at line 99 of file yuvcm.h.
Referenced by ColorTrainWidget::draw_segmentation_result().
|
virtual |
Get file blocks for this colormap.
Implements firevision::Colormap.
|
virtual |
Get the raw buffer of this colormap.
Implements firevision::Colormap.
Definition at line 231 of file yuvcm.cpp.
Referenced by firevision::ColormapFileYuvBlock::ColormapFileYuvBlock().
|
virtual |
Get height of colormap.
Implements firevision::Colormap.
Definition at line 330 of file yuvcm.cpp.
Referenced by firevision::BayesHistosToLut::calculateLutValues(), ColorTrainWidget::load_histograms(), ColorTrainWidget::save_colormap(), FuseTransferWidget::set_current_colormap(), and YuvColormap().
|
virtual |
Convenience method for the method above.
This adds the colormap as in the above method but instead of an instantiated colormap it takes the path to a colormap file which is loaded and added.
filename | file name of colormap to add |
Implements firevision::Colormap.
Definition at line 308 of file yuvcm.cpp.
References firevision::ColormapFile::get_colormap(), and firevision::FireVisionDataFile::read().
Adds the given colormap to this colormap.
This operator takes the given colormap and compares it to this colormap. If this colormap has C_OTHER or C_BACKGROUND the value is compied from the other LUT, otherwise the value is kept as is.
cmlt | other colormap to add |
Implements firevision::Colormap.
|
virtual |
unsigned int firevision::YuvColormap::plane_size | ( | ) | const |
Get U/V plane size.
Definition at line 351 of file yuvcm.cpp.
Referenced by firevision::ColormapFileYuvBlock::ColormapFileYuvBlock(), and firevision::ColormapFile::get_colormap().
void firevision::YuvColormap::replace_color | ( | color_t | from, |
color_t | to | ||
) |
|
virtual |
Reset colormap.
Resets all values to return C_UNKNOWN for every query with determine().
Implements firevision::Colormap.
Definition at line 200 of file yuvcm.cpp.
Referenced by firevision::BayesHistosToLut::calculateLutValues().
|
virtual |
Set to the given raw buffer.
buffer | buffer to copy data from |
Implements firevision::Colormap.
|
virtual |
Set color class for given YUV value.
y | Y value from YUV colorspace |
u | U value from YUV colorspace |
v | V value from YUV colorspace |
c | class for the given YUV color |
Implements firevision::Colormap.
Definition at line 194 of file yuvcm.cpp.
Referenced by firevision::BayesHistosToLut::calculateLutAllColors(), firevision::BayesHistosToLut::calculateLutValues(), FireVisionNetworkTool::fuse_inbound_received(), and FvRetrieverThread::init().
|
virtual |
Size in bytes of buffer returned by get_buffer().
Implements firevision::Colormap.
|
virtual |
Get width of colormap.
Implements firevision::Colormap.
Definition at line 324 of file yuvcm.cpp.
Referenced by firevision::BayesHistosToLut::calculateLutValues(), ColorTrainWidget::load_histograms(), ColorTrainWidget::save_colormap(), FuseTransferWidget::set_current_colormap(), and YuvColormap().