Creates and holds a palette of colors for visualizing different objects in a scene (the intent is for a different color to be applied to each identified object).
The colors are chosen so as to be easily distinguishable. In other words, the intensities are spaced as widely as possible given the number of required colors. Black, white and gray, which has the same value for all the three color channels, are not part of this color palette. This color palette can hold up to 1535 colors.
IdType | The type of value used for label values. |
#include <drake/systems/sensors/color_palette.h>
Public Types | |
using | ColorD = drake::deprecated::internal::Color< double > |
using | ColorI = drake::deprecated::internal::Color< int > |
Public Member Functions | |
ColorPalette (int num_colors, IdType terrain_id, IdType no_body_id) | |
A constructor for ColorPalette. More... | |
const ColorI & | get_color (IdType index) const |
Returns a color of type ColorI which corresponds to given index. More... | |
ColorD | get_normalized_color (IdType index) const |
Returns a color of type ColorD which corresponds to given index. More... | |
const ColorI & | get_sky_color () const |
Returns the color of type ColorI which corresponds to sky. More... | |
const ColorI & | get_terrain_color () const |
Returns the color of type ColorI which corresponds to flat terrain. More... | |
IdType | LookUpId (const ColorI &color) const |
Looks up the ID which corresponds to the given color. More... | |
Does not allow copy, move, or assignment | |
ColorPalette (const ColorPalette &)=delete | |
ColorPalette & | operator= (const ColorPalette &)=delete |
ColorPalette (ColorPalette &&)=delete | |
ColorPalette & | operator= (ColorPalette &&)=delete |
Static Public Member Functions | |
static ColorD | Normalize (const ColorI &color) |
Takes ColorI whose pixel range is [0, 255] and returns ColorD whose pixel range is [0, 1]. More... | |
|
delete |
|
delete |
ColorPalette | ( | int | num_colors, |
IdType | terrain_id, | ||
IdType | no_body_id | ||
) |
A constructor for ColorPalette.
num_colors | The number of colors that you want ColorPalette to hold. We assume this will be the number of rigid bodies in rendering scene. |
terrain_id | The id to express pixels which correspond to flat terrain. This will be used in the label image. |
no_body_id | The id to express pixels that have no body. This will be used in the label image. |
std::exception | When num_colors exceeds the maximum limit, which is 1535. |
const ColorI& get_color | ( | IdType | index | ) | const |
Returns a color of type ColorI which corresponds to given index.
The pixel range of returned color is [0, 255].
index | An index that corresponds to the color to be returned. |
ColorD get_normalized_color | ( | IdType | index | ) | const |
Returns a color of type ColorD which corresponds to given index.
The pixel range of returned color is [0, 1].
index | An index that corresponds to the color to be returned. |
const ColorI& get_sky_color | ( | ) | const |
Returns the color of type ColorI which corresponds to sky.
The pixel range of returned color is [0, 255].
const ColorI& get_terrain_color | ( | ) | const |
Returns the color of type ColorI which corresponds to flat terrain.
The pixel range of returned color is [0, 255].
IdType LookUpId | ( | const ColorI & | color | ) | const |
Looks up the ID which corresponds to the given color.
color | The color you want to know the corresponding ID. |
Takes ColorI whose pixel range is [0, 255] and returns ColorD whose pixel range is [0, 1].
color | An input color to be normalized. |
|
delete |
|
delete |