Public Member Functions | Private Types | Private Attributes | Static Private Attributes
cob_3d_mapping::DominantColor Class Reference

Representing a dominant color of a surface patch. More...

#include <dominant_color.h>

List of all members.

Public Member Functions

void addColor (uint8_t r, uint8_t g, uint8_t b, int weight=1)
 Add the color value of a pixel in RGB.
 DominantColor ()
void getColor (uint8_t &r, uint8_t &g, uint8_t &b) const
 Get the dominant color in RGB.
int getMaxBin () const
 Get the index of the bin with the maximum value.
void hsv2rgb (int h, int s, int v, uint8_t &r, uint8_t &g, uint8_t &b) const
 Convert from HSV to RGB color space.
int incrBin (int h)
 Find the correct bin in the hue histogram and increment.
void reset ()
 Reset all internal variables.
void rgb2hsv (uint8_t r, uint8_t g, uint8_t b, int &h, int &s, int &v) const
 Convert from RGB to HSV color space.
 ~DominantColor ()

Private Types

enum  { HIST_SIZE = 180 }
 Definition of the histogram size. More...

Private Attributes

std::vector< int > hue_histogram_
 The histogram for the hue value.
int sum_b_
 Sum of R, G and B channels from all added points.
int sum_colors_
 Number of added color points.
int sum_g_
int sum_r_

Static Private Attributes

static const float inv_bin_size = 1.0f / 360.0f * HIST_SIZE

Detailed Description

Representing a dominant color of a surface patch.

Definition at line 105 of file dominant_color.h.


Member Enumeration Documentation

anonymous enum [private]

Definition of the histogram size.

Enumerator:
HIST_SIZE 

uint8_t limits hue to 0..255

Definition at line 192 of file dominant_color.h.


Constructor & Destructor Documentation

Definition at line 108 of file dominant_color.h.

Definition at line 113 of file dominant_color.h.


Member Function Documentation

void cob_3d_mapping::DominantColor::addColor ( uint8_t  r,
uint8_t  g,
uint8_t  b,
int  weight = 1 
)

Add the color value of a pixel in RGB.

Parameters:
[in]rThe red channel.
[in]gThe green channel.
[in]bThe blue channel.
[in]weightThe weight of this pixel.

Definition at line 65 of file dominant_color.cpp.

void cob_3d_mapping::DominantColor::getColor ( uint8_t &  r,
uint8_t &  g,
uint8_t &  b 
) const

Get the dominant color in RGB.

Parameters:
[out]rThe red channel.
[out]gThe green channel.
[out]bThe blue channel.

Definition at line 86 of file dominant_color.cpp.

Get the index of the bin with the maximum value.

Returns:
The index of the maximum bin.

Definition at line 113 of file dominant_color.cpp.

void cob_3d_mapping::DominantColor::hsv2rgb ( int  h,
int  s,
int  v,
uint8_t &  r,
uint8_t &  g,
uint8_t &  b 
) const

Convert from HSV to RGB color space.

Parameters:
[in]hThe hue channel.
[in]sThe saturation channel.
[in]vThe value channel.
[out]rThe red channel.
[out]gThe green channel.
[out]bThe blue channel.

Definition at line 161 of file dominant_color.cpp.

Find the correct bin in the hue histogram and increment.

Parameters:
[in]Thehue value.
Returns:
The index of the bin that was incremented.

Definition at line 105 of file dominant_color.cpp.

Reset all internal variables.

Definition at line 227 of file dominant_color.cpp.

void cob_3d_mapping::DominantColor::rgb2hsv ( uint8_t  r,
uint8_t  g,
uint8_t  b,
int &  h,
int &  s,
int &  v 
) const

Convert from RGB to HSV color space.

Parameters:
[in]rThe red channel.
[in]gThe green channel.
[in]bThe blue channel.
[out]hThe hue channel.
[out]sThe saturation channel.
[out]vThe value channel.

Definition at line 129 of file dominant_color.cpp.


Member Data Documentation

The histogram for the hue value.

Definition at line 200 of file dominant_color.h.

const float cob_3d_mapping::DominantColor::inv_bin_size = 1.0f / 360.0f * HIST_SIZE [static, private]

Definition at line 203 of file dominant_color.h.

Sum of R, G and B channels from all added points.

Definition at line 199 of file dominant_color.h.

Number of added color points.

Definition at line 196 of file dominant_color.h.

Definition at line 199 of file dominant_color.h.

Definition at line 199 of file dominant_color.h.


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


cob_3d_mapping_common
Author(s): Georg Arbeiter
autogenerated on Wed Aug 26 2015 11:02:19