hyperion.ng
Public Member Functions | List of all members
hyperion::ImageToLedsMap Class Reference

The ImageToLedsMap holds a mapping of indices into an image to leds. More...

#include <ImageToLedsMap.h>

Public Member Functions

 ImageToLedsMap (const unsigned width, const unsigned height, const unsigned horizontalBorder, const unsigned verticalBorder, const std::vector< Led > &leds)
 Constructs an mapping from the absolute indices in an image to each led based on the border definition given in the list of leds. More...
 
unsigned width () const
 Returns the width of the indexed image. More...
 
unsigned height () const
 Returns the height of the indexed image. More...
 
unsigned horizontalBorder ()
 
unsigned verticalBorder ()
 
template<typename Pixel_T >
std::vector< ColorRgbgetMeanLedColor (const Image< Pixel_T > &image) const
 Determines the mean color for each led using the mapping the image given at construction. More...
 
template<typename Pixel_T >
void getMeanLedColor (const Image< Pixel_T > &image, std::vector< ColorRgb > &ledColors) const
 Determines the mean color for each led using the mapping the image given at construction. More...
 
template<typename Pixel_T >
std::vector< ColorRgbgetUniLedColor (const Image< Pixel_T > &image) const
 Determines the uni color for each led using the mapping the image given at construction. More...
 
template<typename Pixel_T >
void getUniLedColor (const Image< Pixel_T > &image, std::vector< ColorRgb > &ledColors) const
 Determines the uni color for each led using the mapping the image given at construction. More...
 

Detailed Description

The ImageToLedsMap holds a mapping of indices into an image to leds.

It can be used to calculate the average (or mean) color per led for a specific region.

Constructor & Destructor Documentation

§ ImageToLedsMap()

ImageToLedsMap::ImageToLedsMap ( const unsigned  width,
const unsigned  height,
const unsigned  horizontalBorder,
const unsigned  verticalBorder,
const std::vector< Led > &  leds 
)

Constructs an mapping from the absolute indices in an image to each led based on the border definition given in the list of leds.

The map holds absolute indices to any given image, provided that it is row-oriented. The mapping is created purely on size (width and height). The given borders are excluded from indexing.

Parameters
[in]widthThe width of the indexed image
[in]heightThe width of the indexed image
[in]horizontalBorderThe size of the horizontal border (0=no border)
[in]verticalBorderThe size of the vertical border (0=no border)
[in]ledsThe list with led specifications

Member Function Documentation

§ getMeanLedColor() [1/2]

template<typename Pixel_T >
std::vector<ColorRgb> hyperion::ImageToLedsMap::getMeanLedColor ( const Image< Pixel_T > &  image) const
inline

Determines the mean color for each led using the mapping the image given at construction.

Parameters
[in]imageThe image from which to extract the led colors
Returns
ledColors The vector containing the output

§ getMeanLedColor() [2/2]

template<typename Pixel_T >
void hyperion::ImageToLedsMap::getMeanLedColor ( const Image< Pixel_T > &  image,
std::vector< ColorRgb > &  ledColors 
) const
inline

Determines the mean color for each led using the mapping the image given at construction.

Parameters
[in]imageThe image from which to extract the led colors
[out]ledColorsThe vector containing the output

§ getUniLedColor() [1/2]

template<typename Pixel_T >
std::vector<ColorRgb> hyperion::ImageToLedsMap::getUniLedColor ( const Image< Pixel_T > &  image) const
inline

Determines the uni color for each led using the mapping the image given at construction.

Parameters
[in]imageThe image from which to extract the led colors
Returns
ledColors The vector containing the output

§ getUniLedColor() [2/2]

template<typename Pixel_T >
void hyperion::ImageToLedsMap::getUniLedColor ( const Image< Pixel_T > &  image,
std::vector< ColorRgb > &  ledColors 
) const
inline

Determines the uni color for each led using the mapping the image given at construction.

Parameters
[in]imageThe image from which to extract the led colors
[out]ledColorsThe vector containing the output

§ height()

unsigned ImageToLedsMap::height ( ) const

Returns the height of the indexed image.

Returns
The height of the indexed image [pixels]

§ width()

unsigned ImageToLedsMap::width ( ) const

Returns the width of the indexed image.

Returns
The width of the indexed image [pixels]

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