Public Member Functions

firevision::YuvColormap Class Reference

YUV Colormap. More...

#include <>>

Inheritance diagram for firevision::YuvColormap:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 YuvColormap (unsigned int depth=1, unsigned int width=256, unsigned int height=256)
 Constructor.
 YuvColormap (const char *shmem_lut_id, unsigned int depth=1, unsigned int width=256, unsigned int height=256)
 Constructor.
 YuvColormap (const char *shmem_lut_id, bool destroy_on_free, unsigned int depth=1, unsigned int width=256, unsigned int height=256)
 Constructor.
 YuvColormap (YuvColormap *cm, const char *shmem_lut_id, bool destroy_on_free=false)
 Constructor.
virtual ~YuvColormap ()
 Destructor.
virtual color_t determine (unsigned int y, unsigned int u, unsigned int v) const
 Determine color class for given YUV value.
virtual void set (unsigned int y, unsigned int u, unsigned int v, color_t c)
 Set color class for given YUV value.
virtual void reset ()
 Reset colormap.
virtual void set (unsigned char *buffer)
 Set to the given raw buffer.
virtual size_t size ()
 Size in bytes of buffer returned by get_buffer().
virtual unsigned char * get_buffer () const
 Get the raw buffer of this colormap.
virtual Colormapoperator+= (const Colormap &cmlt)
 Adds the given colormap to this colormap.
virtual Colormapoperator+= (const char *filename)
 Convenience method for the method above.
virtual Colormapoperator= (const YuvColormap &yuvcm)
 Assign operation.
virtual unsigned int width () const
 Get width of colormap.
virtual unsigned int height () const
 Get height of colormap.
virtual unsigned int depth () const
 Get depth of colormap.
virtual unsigned int deepness () const
 Get deepness of colormap.
unsigned int plane_size () const
 Get U/V plane size.
virtual std::list
< ColormapFileBlock * > 
get_blocks ()
 Get file blocks for this colormap.
void copy_uvplane (unsigned char *uvplane, unsigned int level)
 Copy single U/V plane.

Detailed Description

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.

Author:
Tim Niemueller

Definition at line 39 of file yuvcm.h.


Constructor & Destructor Documentation

firevision::YuvColormap::YuvColormap ( unsigned int  depth = 1,
unsigned int  width = 256,
unsigned int  height = 256 
)

Constructor.

Parameters:
depth Y resolution depth
width U depth
height V depth

Definition at line 64 of file yuvcm.cpp.

firevision::YuvColormap::YuvColormap ( const char *  shmem_lut_id,
unsigned int  depth = 1,
unsigned int  width = 256,
unsigned int  height = 256 
)

Constructor.

Creates a colormap in shared memory for the given LUT ID.

Parameters:
shmem_lut_id shared memory LUT ID
depth Y depth
width U depth
height V depth

Definition at line 77 of file yuvcm.cpp.

firevision::YuvColormap::YuvColormap ( const char *  shmem_lut_id,
bool  destroy_on_free,
unsigned int  depth = 1,
unsigned int  width = 256,
unsigned int  height = 256 
)

Constructor.

Creates a colormap in shared memory for the given LUT ID.

Parameters:
shmem_lut_id shared memory LUT ID
destroy_on_free true to delete the shared memory segment to delete, false to keep the segment
depth Y depth
width U depth
height V depth

Definition at line 91 of file yuvcm.cpp.

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.

Parameters:
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

Definition at line 104 of file yuvcm.cpp.

References depth(), height(), and width().

firevision::YuvColormap::~YuvColormap (  )  [virtual]

Destructor.

Definition at line 169 of file yuvcm.cpp.


Member Function Documentation

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.

Parameters:
uvplane buffer of U/V plane to copy
level level to copy the plane to
Exceptions:
OutOfBoundsException thrown if level > depth()

Definition at line 237 of file yuvcm.cpp.

Referenced by firevision::ColormapFile::get_colormap().

unsigned int firevision::YuvColormap::deepness (  )  const [virtual]

Get deepness of colormap.

The deepness is the maximum value of depth().

Returns:
colormap deepness, meaning depends on actual colormap implementation

Implements firevision::Colormap.

Definition at line 343 of file yuvcm.cpp.

Referenced by firevision::BayesHistosToLut::calculateLutAllColors(), firevision::BayesHistosToLut::calculateLutValues(), and firevision::ColormapFileYuvBlock::ColormapFileYuvBlock().

unsigned int firevision::YuvColormap::depth (  )  const [virtual]
color_t firevision::YuvColormap::determine ( unsigned int  y,
unsigned int  u,
unsigned int  v 
) const [inline, virtual]

Determine color class for given YUV value.

Parameters:
y Y value from YUV colorspace
u U value from YUV colorspace
v V value from YUV colorspace
Returns:
color class for the given YUV color

Implements firevision::Colormap.

Definition at line 92 of file yuvcm.h.

Referenced by firevision::ColorModelLookupTable::determine(), and ColorTrainWidget::draw_segmentation_result().

std::list< ColormapFileBlock * > firevision::YuvColormap::get_blocks (  )  [virtual]

Get file blocks for this colormap.

Returns:
list of colormap blocks for this colormap.

Implements firevision::Colormap.

Definition at line 210 of file yuvcm.cpp.

unsigned char * firevision::YuvColormap::get_buffer (  )  const [virtual]

Get the raw buffer of this colormap.

Returns:
raw buffer

Implements firevision::Colormap.

Definition at line 224 of file yuvcm.cpp.

Referenced by firevision::ColormapFileYuvBlock::ColormapFileYuvBlock().

unsigned int firevision::YuvColormap::height (  )  const [virtual]

Get height of colormap.

Returns:
colormap height, meaning depends on actual colormap implementation

Implements firevision::Colormap.

Definition at line 329 of file yuvcm.cpp.

Referenced by ColorTrainWidget::add_to_colormap(), firevision::BayesHistosToLut::calculateLutValues(), ColorTrainWidget::load_histograms(), ColorTrainWidget::save_colormap(), FuseTransferWidget::set_current_colormap(), and YuvColormap().

Colormap & firevision::YuvColormap::operator+= ( const char *  filename  )  [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.

Parameters:
filename file name of colormap to add
Returns:
reference to this

Implements firevision::Colormap.

Definition at line 305 of file yuvcm.cpp.

References firevision::ColormapFile::get_colormap(), and firevision::FireVisionDataFile::read().

Colormap & firevision::YuvColormap::operator+= ( const Colormap cmlt  )  [virtual]

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.

Parameters:
cmlt other colormap to add
Returns:
reference to this

Implements firevision::Colormap.

Definition at line 255 of file yuvcm.cpp.

Colormap & firevision::YuvColormap::operator= ( const YuvColormap yuvcm  )  [virtual]

Assign operation.

Copies all values from the given colormap.

Parameters:
yuvcm colormap which's data to copy to this instance
Exceptions:
TypeMismatchException thrown if depth of colormaps does not match.
Returns:
reference to this

Definition at line 292 of file yuvcm.cpp.

unsigned int firevision::YuvColormap::plane_size (  )  const

Get U/V plane size.

Returns:
size of a single U/V plane

Definition at line 353 of file yuvcm.cpp.

Referenced by firevision::ColormapFileYuvBlock::ColormapFileYuvBlock(), and firevision::ColormapFile::get_colormap().

void firevision::YuvColormap::reset (  )  [virtual]

Reset colormap.

Resets all values to return C_UNKNOWN for every query with determine().

Implements firevision::Colormap.

Definition at line 189 of file yuvcm.cpp.

Referenced by firevision::BayesHistosToLut::calculateLutValues(), firevision::ColorModelLookupTable::reset(), and firevision::BayesColormapGenerator::reset().

void firevision::YuvColormap::set ( unsigned char *  buffer  )  [virtual]

Set to the given raw buffer.

Parameters:
buffer buffer to copy data from

Implements firevision::Colormap.

Definition at line 196 of file yuvcm.cpp.

void firevision::YuvColormap::set ( unsigned int  y,
unsigned int  u,
unsigned int  v,
color_t  c 
) [virtual]

Set color class for given YUV value.

Parameters:
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 182 of file yuvcm.cpp.

Referenced by firevision::BayesHistosToLut::calculateLutAllColors(), firevision::BayesHistosToLut::calculateLutValues(), and FvRetrieverThread::init().

size_t firevision::YuvColormap::size (  )  [virtual]

Size in bytes of buffer returned by get_buffer().

Returns:
size in bytes of buffer returned by get_buffer()

Implements firevision::Colormap.

Definition at line 203 of file yuvcm.cpp.

unsigned int firevision::YuvColormap::width (  )  const [virtual]

Get width of colormap.

Returns:
colormap width, meaning depends on actual colormap implementation

Implements firevision::Colormap.

Definition at line 322 of file yuvcm.cpp.

Referenced by ColorTrainWidget::add_to_colormap(), firevision::BayesHistosToLut::calculateLutValues(), ColorTrainWidget::load_histograms(), ColorTrainWidget::save_colormap(), FuseTransferWidget::set_current_colormap(), and YuvColormap().


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