Visual Servoing Platform  version 3.6.1 under development (2024-11-15)
vpColormap Class Reference

#include <visp3/core/vpColormap.h>

Public Types

enum  vpColormapType {
  COLORMAP_AUTUMN , COLORMAP_CIVIDIS , COLORMAP_COOL , COLORMAP_GIST_EARTH ,
  COLORMAP_GNUPLOT , COLORMAP_GNUPLOT2 , COLORMAP_HOT , COLORMAP_HSV ,
  COLORMAP_INFERNO , COLORMAP_JET , COLORMAP_MAGMA , COLORMAP_OCEAN ,
  COLORMAP_PLASMA , COLORMAP_RAINBOW , COLORMAP_SPRING , COLORMAP_SUMMER ,
  COLORMAP_TERRAIN , COLORMAP_TURBO , COLORMAP_TWILIGHT , COLORMAP_TWILIGHT_SHIFTED ,
  COLORMAP_VIRIDIS , COLORMAP_WINTER
}
 

Public Member Functions

 vpColormap (const vpColormapType &colormapType)
 
void convert (const vpImage< unsigned char > &I, vpImage< vpRGBa > &Icolor, bool normalize=false)
 
void convert (const vpImage< vpRGBa > &I, vpImage< vpRGBa > &Icolor, bool normalize=false)
 
void convert (const vpImage< float > &I, vpImage< vpRGBa > &Icolor)
 
void convert (const vpImage< vpRGBf > &I, vpImage< vpRGBa > &Icolor)
 

Detailed Description

Creates a colormap class to be able to recolor an image with different grayscale values into some corresponding color values, for better visualization for example.

Examples
tutorial-image-colormap.cpp.

Definition at line 57 of file vpColormap.h.

Member Enumeration Documentation

◆ vpColormapType

Enumerator
COLORMAP_AUTUMN 
COLORMAP_CIVIDIS 
COLORMAP_COOL 
COLORMAP_GIST_EARTH 
COLORMAP_GNUPLOT 
COLORMAP_GNUPLOT2 
COLORMAP_HOT 
COLORMAP_HSV 
COLORMAP_INFERNO 
COLORMAP_JET 
COLORMAP_MAGMA 
COLORMAP_OCEAN 
COLORMAP_PLASMA 
COLORMAP_RAINBOW 
COLORMAP_SPRING 
COLORMAP_SUMMER 
COLORMAP_TERRAIN 
COLORMAP_TURBO 
COLORMAP_TWILIGHT 
COLORMAP_TWILIGHT_SHIFTED 
COLORMAP_VIRIDIS 
COLORMAP_WINTER 

Definition at line 60 of file vpColormap.h.

Constructor & Destructor Documentation

◆ vpColormap()

BEGIN_VISP_NAMESPACE vpColormap::vpColormap ( const vpColormapType colormapType)

Creates a colormap class to be able to recolor an image with different grayscale values into some corresponding color values, for better visualization for example.

Note
The different colormap types come from the Matplotlib library.
Parameters
[in]colormapType: Colormap family.

Definition at line 1020 of file vpColormap.cpp.

References COLORMAP_AUTUMN, COLORMAP_CIVIDIS, COLORMAP_COOL, COLORMAP_GIST_EARTH, COLORMAP_GNUPLOT, COLORMAP_GNUPLOT2, COLORMAP_HOT, COLORMAP_HSV, COLORMAP_INFERNO, COLORMAP_JET, COLORMAP_MAGMA, COLORMAP_OCEAN, COLORMAP_PLASMA, COLORMAP_RAINBOW, COLORMAP_SPRING, COLORMAP_SUMMER, COLORMAP_TERRAIN, COLORMAP_TURBO, COLORMAP_TWILIGHT, COLORMAP_TWILIGHT_SHIFTED, COLORMAP_VIRIDIS, and COLORMAP_WINTER.

Member Function Documentation

◆ convert() [1/4]

void vpColormap::convert ( const vpImage< float > &  I,
vpImage< vpRGBa > &  Icolor 
)

Apply a colormap to a floating-point image:

  • the min, max values are first extracted from I
  • the different values are remapped into the [0 - 255] range,
  • the colormap is applied on these unsigned char values.
Parameters
[in]I: The float image on which the colormap will be apply.
[out]Icolor: Colorized image.

Definition at line 1177 of file vpColormap.cpp.

References vpImage< Type >::getHeight(), vpImage< Type >::getMinMaxValue(), vpImage< Type >::getWidth(), and vpImage< Type >::resize().

◆ convert() [2/4]

void vpColormap::convert ( const vpImage< unsigned char > &  I,
vpImage< vpRGBa > &  Icolor,
bool  normalize = false 
)

Apply a colormap to a 8-bit grayscale image:

  • if normalize is set to true, the min, max values are first extracted from I
  • the different values are remapped into the [0 - 255] range,
  • the colormap is applied on these unsigned char values,
  • otherwise, the grayscale values are directly mapped using the colormap.
Parameters
[in]I: The 8-bit grayscale image on which the colormap will be apply.
[out]Icolor: Colorized image.
[in]normalize: If true, normalization into the [0 - 255] range is applied, otherwise the grayscale values are directly mapped.
Examples
tutorial-image-colormap.cpp.

Definition at line 1110 of file vpColormap.cpp.

References vpImage< Type >::getHeight(), vpImage< Type >::getMinMaxValue(), vpImage< Type >::getWidth(), and vpImage< Type >::resize().

Referenced by convert().

◆ convert() [3/4]

void vpColormap::convert ( const vpImage< vpRGBa > &  I,
vpImage< vpRGBa > &  Icolor,
bool  normalize = false 
)

Apply a colormap to a 8-bit RGB image:

  • the RGB values are first converted to grayscale values,
  • if normalize is set to true, the min, max values are then extracted from I
  • the different values are remapped into the [0 - 255] range,
  • the colormap is applied on these unsigned char values,
  • otherwise, the grayscale values are directly mapped using the colormap.
Parameters
[in]I: The 8-bit grayscale image on which the colormap will be apply.
[out]Icolor: Colorized image.
[in]normalize: If true, normalization into the [0 - 255] range is applied, otherwise the grayscale values are directly mapped.

Definition at line 1157 of file vpColormap.cpp.

References convert(), vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().

◆ convert() [4/4]

void vpColormap::convert ( const vpImage< vpRGBf > &  I,
vpImage< vpRGBa > &  Icolor 
)

Apply a colormap to a 3 channels floating-point image:

  • the RGB values are converted using the grayscale formula,
  • the min, max values are first extracted from I
  • the different values are remapped into the [0 - 255] range,
  • the colormap is applied on these unsigned char values.
Parameters
[in]I: The float image on which the colormap will be apply.
[out]Icolor: Colorized image.

Definition at line 1211 of file vpColormap.cpp.

References convert(), vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().