Simox  2.3.74.0
simox::color Namespace Reference

Namespaces

 interpol
 

Data Structures

struct  Color
 An RGBA color, where each component is a byte in [0, 255]. More...
 
class  ColorMap
 A color map, mapping scalar values to colors. More...
 
class  GlasbeyLUT
 
struct  KellyColor
 An RGBA color, where each component is a byte in [0, 255]. Additionally contains an id denoting its position. More...
 
class  KellyColorStack
 Stack of 20 distinguishable colors by Kenneth L. Kelly but without black and white, e.g. usable for creating graphs. More...
 
class  KellyLUT
 20 distinguishable colors by Kenneth L. Kelly but without black and white, e.g. usable for creating graphs More...
 

Functions

std::ostream & operator<< (std::ostream &os, const Color &c)
 
bool operator== (const Color &lhs, const Color &rhs)
 
bool operator!= (const Color &lhs, const Color &rhs)
 
template<typename Int , std::enable_if_t< std::is_integral_v< Int >, int > = 0>
uint8_t to_byte (Int value)
 Convert an integral type to a byte in [0, 255]. More...
 
template<typename Float , std::enable_if_t< std::is_floating_point_v< Float >, int > = 0>
uint8_t to_byte (Float value)
 Convert a floating point type to a byte in [0, 255]. More...
 
template<typename Int , std::enable_if_t< std::is_integral_v< Int >, int > = 0>
float to_float (Int value)
 Convert an integral point type to a float in [0.0, 1.0]. More...
 
template<typename Float , std::enable_if_t< std::is_floating_point_v< Float >, int > = 0>
float to_float (Float value)
 Convert a floating pont type to a float in [0.0, 1.0]. More...
 
template<typename Scalar , int Rows, int Cols>
Eigen::Matrix< int, Rows, Cols > to_byte (Eigen::Matrix< Scalar, Rows, Cols > vector)
 
template<typename Scalar , int Rows, int Cols>
Eigen::Matrix< float, Rows, Cols > to_float (Eigen::Matrix< Scalar, Rows, Cols > vector)
 
Eigen::Vector3f rgb_to_hsv (const Eigen::Vector3f &rgb)
 Convert an RGB color to HSV. More...
 
Eigen::Vector3f hsv_to_rgb (const Eigen::Vector3f &hsv)
 Convert an HSV color to RGB. More...
 
Color linear_hsv (float t, const Color &lhs, const Color &rhs)
 Interpolate linearly in HSV space. (lhs and rhs are expected to be RGB.) More...
 
void to_json (nlohmann::json &j, const Color &color)
 
void from_json (const nlohmann::json &j, Color &color)
 

Variables

static const std::vector< uint8_t > GLASBEY_LUT
 Glasbey lookup table. More...
 

Function Documentation

◆ from_json()

void simox::color::from_json ( const nlohmann::json j,
Color color 
)

◆ hsv_to_rgb()

Eigen::Vector3f simox::color::hsv_to_rgb ( const Eigen::Vector3f &  hsv)

Convert an HSV color to RGB.

See also
simox::color::rgb_to_hsv() for the expected intervals.
Parameters
hsvThe HSV color in [0, 360] x [0, 1] x [0, 1]
Returns
The RGB color with all channels in [0, 1].

◆ linear_hsv()

Color simox::color::linear_hsv ( float  t,
const Color lhs,
const Color rhs 
)

Interpolate linearly in HSV space. (lhs and rhs are expected to be RGB.)

◆ operator!=()

bool simox::color::operator!= ( const Color lhs,
const Color rhs 
)
inline

◆ operator<<()

std::ostream& simox::color::operator<< ( std::ostream &  os,
const Color c 
)
inline

◆ operator==()

bool simox::color::operator== ( const Color lhs,
const Color rhs 
)
inline

◆ rgb_to_hsv()

Eigen::Vector3f simox::color::rgb_to_hsv ( const Eigen::Vector3f &  rgb)

Convert an RGB color to HSV.

Hue is measured in degrees, i.e. [0, 360]. All other channels (saturation, value, red, green, blue) are in the interval [0, 1].

Parameters
rgbThe RGB color with all channels in range [0, 1].
Returns
The HSV color in [0, 360] x [0, 1] x [0, 1].

◆ to_byte() [1/3]

template<typename Int , std::enable_if_t< std::is_integral_v< Int >, int > = 0>
uint8_t simox::color::to_byte ( Int  value)

Convert an integral type to a byte in [0, 255].

◆ to_byte() [2/3]

template<typename Float , std::enable_if_t< std::is_floating_point_v< Float >, int > = 0>
uint8_t simox::color::to_byte ( Float  value)

Convert a floating point type to a byte in [0, 255].

◆ to_byte() [3/3]

template<typename Scalar , int Rows, int Cols>
Eigen::Matrix<int, Rows, Cols> simox::color::to_byte ( Eigen::Matrix< Scalar, Rows, Cols >  vector)

◆ to_float() [1/3]

template<typename Int , std::enable_if_t< std::is_integral_v< Int >, int > = 0>
float simox::color::to_float ( Int  value)

Convert an integral point type to a float in [0.0, 1.0].

◆ to_float() [2/3]

template<typename Float , std::enable_if_t< std::is_floating_point_v< Float >, int > = 0>
float simox::color::to_float ( Float  value)

Convert a floating pont type to a float in [0.0, 1.0].

◆ to_float() [3/3]

template<typename Scalar , int Rows, int Cols>
Eigen::Matrix<float, Rows, Cols> simox::color::to_float ( Eigen::Matrix< Scalar, Rows, Cols >  vector)

◆ to_json()

void simox::color::to_json ( nlohmann::json j,
const Color color 
)

Variable Documentation

◆ GLASBEY_LUT

const std::vector<uint8_t> simox::color::GLASBEY_LUT
static

Glasbey lookup table.