firevision::Colormap Class Reference

Colormap interface. More...

#include <fvutils/colormap/colormap.h>

Inheritance diagram for firevision::Colormap:

[legend]
List of all members.

Public Member Functions

virtual ~Colormap ()
 Virtual empty destructor.
virtual color_t determine (unsigned int y, unsigned int u, unsigned int v) const =0
 Determine color class for given YUV value.
virtual void set (unsigned int y, unsigned int u, unsigned int v, color_t c)=0
 Set color class for given YUV value.
virtual void reset ()=0
 Reset colormap.
virtual void set (unsigned char *buffer)=0
 Set to the given raw buffer.
virtual size_t size ()=0
 Size in bytes of buffer returned by get_buffer().
virtual void to_image (unsigned char *yuv422_planar_buffer, unsigned int level=0)
 Create image from LUT.
virtual unsigned int image_height () const
 Height of conversion image.
virtual unsigned int image_width () const
 Width of conversion image.
virtual unsigned char * get_buffer () const =0
 Get the raw buffer of this colormap.
virtual Colormapoperator+= (const Colormap &cmlt)=0
 Adds the given colormap to this colormap.
virtual Colormapoperator+= (const char *filename)=0
 Convenience method for the method above.
virtual unsigned int width () const =0
 Get width of colormap.
virtual unsigned int height () const =0
 Get height of colormap.
virtual unsigned int depth () const =0
 Get depth of colormap.
virtual unsigned int deepness () const =0
 Get deepness of colormap.
virtual std::list< ColormapFileBlock * > get_blocks ()=0
 Get file blocks for this colormap.

Detailed Description

Colormap interface.

This C++ pure virtual class describes the interface to a generic colormap. It is currently tailored to the YUV colorspace.

Author:
Tim Niemueller

Definition at line 38 of file colormap.h.


Constructor & Destructor Documentation

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

Virtual empty destructor.

Definition at line 111 of file colormap.cpp.


Member Function Documentation

unsigned int firevision::Colormap::deepness (  )  const [pure virtual]

Get deepness of colormap.

The deepness is the maximum value of depth().

Returns:
colormap deepness, meaning depends on actual colormap implementation

Implemented in firevision::YuvColormap.

Referenced by ColormapViewerWidget::draw(), ColormapViewerWidget::set_colormap(), ColormapViewerWidget::set_layer_selector(), and to_image().

unsigned int firevision::Colormap::depth (  )  const [pure virtual]

Get depth of colormap.

Returns:
colormap depth, meaning depends on actual colormap implementation

Implemented in firevision::YuvColormap.

Referenced by firevision::ColormapFile::add_colormap(), ColormapViewerWidget::draw(), ColorTrainWidget::load_colormap(), FireVisionNetworkTool::set_colormap(), and to_image().

color_t firevision::Colormap::determine ( unsigned int  y,
unsigned int  u,
unsigned int  v 
) const [pure 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

Implemented in firevision::YuvColormap.

Referenced by to_image().

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

Get file blocks for this colormap.

Returns:
list of colormap blocks for this colormap.

Implemented in firevision::YuvColormap.

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

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

Get the raw buffer of this colormap.

Returns:
raw buffer

Implemented in firevision::YuvColormap.

Referenced by FireVisionNetworkTool::set_colormap().

unsigned int firevision::Colormap::height (  )  const [pure virtual]

Get height of colormap.

Returns:
colormap height, meaning depends on actual colormap implementation

Implemented in firevision::YuvColormap.

Referenced by firevision::ColormapFile::add_colormap(), ColorTrainWidget::load_colormap(), FireVisionNetworkTool::set_colormap(), and to_image().

unsigned int firevision::Colormap::image_height (  )  const [virtual]

Height of conversion image.

The buffer passed into to_image() must have the returned width.

Returns:
required width for colormap visualization image

Definition at line 186 of file colormap.cpp.

Referenced by ColormapViewerWidget::draw(), and to_image().

unsigned int firevision::Colormap::image_width (  )  const [virtual]

Width of conversion image.

The buffer passed into to_image() must have the returned width.

Returns:
required width for colormap visualization image

Definition at line 176 of file colormap.cpp.

Referenced by ColormapViewerWidget::draw(), and to_image().

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

Implemented in firevision::YuvColormap.

Colormap & firevision::Colormap::operator+= ( const Colormap cmlt  )  [pure 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

Implemented in firevision::YuvColormap.

void firevision::Colormap::reset (  )  [pure virtual]

Reset colormap.

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

Implemented in firevision::YuvColormap.

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

Set to the given raw buffer.

Parameters:
buffer buffer to copy data from

Implemented in firevision::YuvColormap.

void firevision::Colormap::set ( unsigned int  y,
unsigned int  u,
unsigned int  v,
color_t  c 
) [pure 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

Implemented in firevision::YuvColormap.

size_t firevision::Colormap::size (  )  [pure virtual]

Size in bytes of buffer returned by get_buffer().

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

Implemented in firevision::YuvColormap.

void firevision::Colormap::to_image ( unsigned char *  yuv422_planar_buffer,
unsigned int  level = 0 
) [virtual]

Create image from LUT.

Create image from LUT, useful for debugging and analysing. This method produces a representation of the given level (Y range with 0 <= level < depth) for visual inspection of the colormap. The dimensions of the resulting image are 512x512 pixels. It uses standard strong colors for the different standard color classes. C_UNKNOWN is grey, C_BACKGROUND is black (like C_BLACK). If the standard method does not suit your needs you can override this method.

Parameters:
yuv422_planar_buffer contains the image upon return, must be initialized with the appropriate memory size before calling, dimensions are 512x512 pixels.
level the level to draw, it's a range in the Y direction and is in the range 0 <= level < depth.

Definition at line 129 of file colormap.cpp.

References deepness(), depth(), determine(), firevision::ColorObjectMap::get_color(), height(), image_height(), image_width(), firevision::YUV_t_struct::U, firevision::YUV_t_struct::V, width(), and firevision::YUV_t_struct::Y.

Referenced by ColormapViewerWidget::draw().

unsigned int firevision::Colormap::width (  )  const [pure virtual]

Get width of colormap.

Returns:
colormap width, meaning depends on actual colormap implementation

Implemented in firevision::YuvColormap.

Referenced by firevision::ColormapFile::add_colormap(), ColorTrainWidget::load_colormap(), FireVisionNetworkTool::set_colormap(), and to_image().


The documentation for this class was generated from the following files:
Generated on Tue Feb 22 13:33:00 2011 for Fawkes API by  doxygen 1.4.7