Fawkes API  Fawkes Development Version
firevision::Colormap Class Referenceabstract

Colormap interface. More...

#include <>>

Inheritance diagram for firevision::Colormap:

Public Member Functions

virtual ~Colormap ()
 Virtual empty destructor. More...
 
virtual color_t determine (unsigned int y, unsigned int u, unsigned int v) const =0
 Determine color class for given YUV value. More...
 
virtual void set (unsigned int y, unsigned int u, unsigned int v, color_t c)=0
 Set color class for given YUV value. More...
 
virtual void reset ()=0
 Reset colormap. More...
 
virtual void set (unsigned char *buffer)=0
 Set to the given raw buffer. More...
 
virtual size_t size ()=0
 Size in bytes of buffer returned by get_buffer(). 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...
 
virtual unsigned char * get_buffer () const =0
 Get the raw buffer of this colormap. More...
 
virtual Colormapoperator+= (const Colormap &cmlt)=0
 Adds the given colormap to this colormap. More...
 
virtual Colormapoperator+= (const char *filename)=0
 Convenience method for the method above. More...
 
virtual unsigned int width () const =0
 Get width of colormap. More...
 
virtual unsigned int height () const =0
 Get height of colormap. More...
 
virtual unsigned int depth () const =0
 Get depth of colormap. More...
 
virtual unsigned int deepness () const =0
 Get deepness of colormap. More...
 
virtual std::list< ColormapFileBlock * > get_blocks ()=0
 Get file blocks for this colormap. More...
 

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

◆ ~Colormap()

firevision::Colormap::~Colormap ( )
virtual

Virtual empty destructor.

Definition at line 111 of file colormap.cpp.

Member Function Documentation

◆ deepness()

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::set_colormap(), and to_image().

◆ depth()

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(), ColorTrainWidget::load_colormap(), FireVisionNetworkTool::set_colormap(), and to_image().

◆ determine()

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
yY value from YUV colorspace
uU value from YUV colorspace
vV value from YUV colorspace
Returns
color class for the given YUV color

Implemented in firevision::YuvColormap.

Referenced by to_image().

◆ get_blocks()

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().

◆ get_buffer()

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().

◆ height()

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(), firevision::FileLoader::set_pixel_height(), and to_image().

◆ image_height()

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 to_image().

◆ image_width()

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 to_image().

◆ operator+=() [1/2]

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
cmltother colormap to add
Returns
reference to this

Implemented in firevision::YuvColormap.

◆ operator+=() [2/2]

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
filenamefile name of colormap to add
Returns
reference to this

Implemented in firevision::YuvColormap.

◆ reset()

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

Reset colormap.

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

Implemented in firevision::YuvColormap.

◆ set() [1/2]

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
yY value from YUV colorspace
uU value from YUV colorspace
vV value from YUV colorspace
cclass for the given YUV color

Implemented in firevision::YuvColormap.

◆ set() [2/2]

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

Set to the given raw buffer.

Parameters
bufferbuffer to copy data from

Implemented in firevision::YuvColormap.

◆ size()

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.

◆ to_image()

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_buffercontains the image upon return, must be initialized with the appropriate memory size before calling, dimensions are 512x512 pixels.
levelthe 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 firevision::FileLoader::set_pixel_height().

◆ width()

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(), firevision::FileLoader::set_pixel_height(), and to_image().


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