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 |
virtual void | set (unsigned int y, unsigned int u, unsigned int v, color_t c) |
virtual void | reset () |
virtual void | set (unsigned char *buffer) |
virtual size_t | size () |
virtual unsigned char * | get_buffer () const |
virtual Colormap & | operator+= (const Colormap &cmlt) |
Adds the given colormap to this colormap. More... | |
virtual Colormap & | operator+= (const char *filename) |
virtual Colormap & | operator= (const YuvColormap &yuvcm) |
Assign operation. More... | |
virtual unsigned int | width () const |
virtual unsigned int | height () const |
virtual unsigned int | depth () const |
virtual unsigned int | deepness () const |
unsigned int | plane_size () const |
Get U/V plane size. More... | |
virtual std::list< ColormapFileBlock * > | get_blocks () |
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 | ||
) |
|
virtual |
Get deepness of colormap. The deepness is the maximum value of depth().
Implements firevision::Colormap.
Definition at line 341 of file yuvcm.cpp.
Referenced by firevision::BayesHistosToLut::calculateLutAllColors(), and firevision::BayesHistosToLut::calculateLutValues().
|
virtual |
Get depth of colormap.
Implements firevision::Colormap.
Definition at line 335 of file yuvcm.cpp.
Referenced by firevision::BayesHistosToLut::calculateLutAllColors(), firevision::BayesHistosToLut::calculateLutValues(), 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 103 of file yuvcm.h.
Referenced by ColorTrainWidget::draw_segmentation_result().
|
virtual |
Get file blocks for this colormap.
Implements firevision::Colormap.
|
virtual |
|
virtual |
Get height of colormap.
Implements firevision::Colormap.
Definition at line 329 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 307 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 |
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 199 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 193 of file yuvcm.cpp.
Referenced by firevision::BayesHistosToLut::calculateLutAllColors(), firevision::BayesHistosToLut::calculateLutValues(), FuseTransferWidget::fuse_inbound_received(), 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 323 of file yuvcm.cpp.
Referenced by firevision::BayesHistosToLut::calculateLutValues(), ColorTrainWidget::load_histograms(), ColorTrainWidget::save_colormap(), FuseTransferWidget::set_current_colormap(), and YuvColormap().