Fawkes API  Fawkes Development Version
firevision::ColorModelLookupTable Class Reference

Color model based on a lookup table. More...

#include <>>

Inheritance diagram for firevision::ColorModelLookupTable:

Public Member Functions

 ColorModelLookupTable (YuvColormap *colormap)
 Create a lookup table with given dimensions not using shared memory. More...
 
 ColorModelLookupTable (const char *file)
 Create a lookup table, load contents from file. More...
 
 ColorModelLookupTable (const char *file, const char *lut_id, bool destroy_on_free=false)
 Create a lookup table using shared memory, load contents from file. More...
 
 ColorModelLookupTable (unsigned int depth, const char *lut_id, bool destroy_on_free)
 Create a lookup table with given dimensions using shared memory. More...
 
 ColorModelLookupTable (const char *lut_id, bool destroy_on_free)
 Create a lookup table with given dimensions using shared memory. More...
 
virtual ~ColorModelLookupTable ()
 Destructor. More...
 
virtual color_t determine (unsigned int y, unsigned int u, unsigned int v) const
 Determine classification of YUV pixel. More...
 
const char * get_name ()
 Get name of color model. More...
 
YuvColormapget_colormap () const
 Get colormap. More...
 
void load (const char *filename)
 Load colormap from file. More...
 
void set_colormap (const YuvColormap &yuvcm)
 Set colormap. More...
 
void reset ()
 Reset colormap. More...
 
ColorModelLookupTableoperator+= (const ColorModelLookupTable &cmlt)
 Add colormaps. More...
 
- Public Member Functions inherited from firevision::ColorModel
virtual ~ColorModel ()
 Virtual empty destructor. More...
 
virtual void uv_to_image (unsigned char *yuv422_planar_buffer, unsigned int y)
 Create image from color model. More...
 

Static Public Member Functions

static std::string compose_filename (const std::string format)
 Compose filename. More...
 

Detailed Description

Color model based on a lookup table.

Very fast and easy implementation of a lookup table. It ignores the luminance and determines the classification just based on the U and V chrominance values. This model is very versatile as you can generate the lookuptable with many different methods.

Definition at line 37 of file lookuptable.h.

Constructor & Destructor Documentation

◆ ColorModelLookupTable() [1/5]

firevision::ColorModelLookupTable::ColorModelLookupTable ( YuvColormap colormap)

Create a lookup table with given dimensions not using shared memory.

Parameters
colormapcolormap to use, the colormap is consumed, meaning that the color model takes ownership of the colormap and deletes it in its dtor.

Definition at line 64 of file lookuptable.cpp.

◆ ColorModelLookupTable() [2/5]

firevision::ColorModelLookupTable::ColorModelLookupTable ( const char *  file)

Create a lookup table, load contents from file.

Parameters
filename of the file to load from

Definition at line 115 of file lookuptable.cpp.

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

◆ ColorModelLookupTable() [3/5]

firevision::ColorModelLookupTable::ColorModelLookupTable ( const char *  file,
const char *  lut_id,
bool  destroy_on_free = false 
)

Create a lookup table using shared memory, load contents from file.

Parameters
filename of the file to load from
lut_idID of the LUT in shared memory, use a constant from utils/shm_registry.h
destroy_on_freetrue to destroy lookup table in shmem on delete

Definition at line 96 of file lookuptable.cpp.

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

◆ ColorModelLookupTable() [4/5]

firevision::ColorModelLookupTable::ColorModelLookupTable ( unsigned int  depth,
const char *  lut_id,
bool  destroy_on_free 
)

Create a lookup table with given dimensions using shared memory.

Parameters
depthdepth of the lookup table
lut_idID of the LUT in shared memory
destroy_on_freetrue to destroy lookup table in shmem on delete

Definition at line 84 of file lookuptable.cpp.

◆ ColorModelLookupTable() [5/5]

firevision::ColorModelLookupTable::ColorModelLookupTable ( const char *  lut_id,
bool  destroy_on_free 
)

Create a lookup table with given dimensions using shared memory.

Parameters
lut_idID of the LUT in shared memory
destroy_on_freetrue to destroy lookup table in shmem on delete

Definition at line 73 of file lookuptable.cpp.

◆ ~ColorModelLookupTable()

firevision::ColorModelLookupTable::~ColorModelLookupTable ( )
virtual

Destructor.

Definition at line 129 of file lookuptable.cpp.

Member Function Documentation

◆ compose_filename()

std::string firevision::ColorModelLookupTable::compose_filename ( const std::string  format)
static

Compose filename.

Parameters
formatformat string
Returns
composed filename
See also
ColormapFile::compose_filename()

Definition at line 212 of file lookuptable.cpp.

◆ determine()

color_t firevision::ColorModelLookupTable::determine ( unsigned int  y,
unsigned int  u,
unsigned int  v 
) const
virtual

Determine classification of YUV pixel.

Given a pixel in the YUV colorspace the colormodel determines the color classification based on some a-priori knowledge.

Parameters
yY value
uU value
vV value
Returns
color classification

Implements firevision::ColorModel.

Definition at line 135 of file lookuptable.cpp.

◆ get_colormap()

YuvColormap * firevision::ColorModelLookupTable::get_colormap ( ) const

Get colormap.

Returns
a pointer to the YUV colormap used internally.

Definition at line 150 of file lookuptable.cpp.

Referenced by FvRetrieverThread::init().

◆ get_name()

const char * firevision::ColorModelLookupTable::get_name ( )
virtual

Get name of color model.

Returns
name of color model.
Author
Tim Niemueller

Implements firevision::ColorModel.

Definition at line 141 of file lookuptable.cpp.

◆ load()

void firevision::ColorModelLookupTable::load ( const char *  filename)

Load colormap from file.

Parameters
filenamename of colormap file

Definition at line 171 of file lookuptable.cpp.

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

◆ operator+=()

ColorModelLookupTable & firevision::ColorModelLookupTable::operator+= ( const ColorModelLookupTable cmlt)

Add colormaps.

This adds the colormap of the given lookuptable color model to internals colormap.

Parameters
cmltlookup table color model to copy data from
Returns
this

Definition at line 192 of file lookuptable.cpp.

◆ reset()

void firevision::ColorModelLookupTable::reset ( )

Reset colormap.

Definition at line 201 of file lookuptable.cpp.

References reset().

Referenced by reset().

◆ set_colormap()

void firevision::ColorModelLookupTable::set_colormap ( const YuvColormap yuvcm)

Set colormap.

Parameters
yuvcmcolormap to assign. The content of the colormap is copied into the internal one.

Definition at line 161 of file lookuptable.cpp.


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