Drake
ColorPalette Class Reference

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). More...

#include <drake/systems/sensors/color_palette.h>

## Public Member Functions

ColorPalette (int num_colors, int terrain_id, int no_body_id)
A constructor for ColorPalette. More...

const ColorIget_color (int index) const
Returns a color of type ColorI which corresponds to given index. More...

ColorD get_normalized_color (int index) const
Returns a color of type ColorD which corresponds to given index. More...

const ColorIget_sky_color () const
Returns the color of type ColorI which corresponds to sky. More...

const ColorIget_terrain_color () const
Returns the color of type ColorI which corresponds to flat terrain. More...

int LookUpId (const ColorI &color) const
Looks up an ID which corresponds to the given color. More...

Does not allow copy, move, or assignment
ColorPalette (const ColorPalette &)=delete

ColorPaletteoperator= (const ColorPalette &)=delete

ColorPalette (ColorPalette &&)=delete

ColorPaletteoperator= (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...

## Detailed Description

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.

## Constructor & Destructor Documentation

 ColorPalette ( const ColorPalette & )
delete
 ColorPalette ( ColorPalette && )
delete
 ColorPalette ( int num_colors, int terrain_id, int no_body_id )
inline

A constructor for ColorPalette.

Parameters
 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.
Exceptions
 std::logic_error When num_colors exceeds the maximum limit, which is 1535.

Here is the call graph for this function:

## Member Function Documentation

 const ColorI& get_color ( int index ) const
inline

Returns a color of type ColorI which corresponds to given index.

The pixel range of returned color is [0, 255].

Parameters
 index An index that corresponds to the color to be returned.
 ColorD get_normalized_color ( int index ) const
inline

Returns a color of type ColorD which corresponds to given index.

The pixel range of returned color is [0, 1].

Parameters
 index An index that corresponds to the color to be returned.
 const ColorI& get_sky_color ( ) const
inline

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
inline

Returns the color of type ColorI which corresponds to flat terrain.

The pixel range of returned color is [0, 255].

 int LookUpId ( const ColorI & color ) const
inline

Looks up an ID which corresponds to the given color.

Parameters
 color The color you want to know the corresponding ID.
 static ColorD Normalize ( const ColorI & color )
inlinestatic

Takes ColorI whose pixel range is [0, 255] and returns ColorD whose pixel range is [0, 1].

Parameters
 color An input color to be normalized.
 ColorPalette& operator= ( const ColorPalette & )
delete
 ColorPalette& operator= ( ColorPalette && )
delete

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