se2ez
colormap.h
Go to the documentation of this file.
1 /* Author: Zachary Kingston */
2 
3 #ifndef SE2EZ_CORE_COLORMAP_
4 #define SE2EZ_CORE_COLORMAP_
5 
6 namespace se2ez
7 {
8  /** \brief Maps a scalar s in [0, 1] to the Viridis colormap.
9  * \param[in] s Scalar to map.
10  * \param[out] r Red value in [0, 1]
11  * \param[out] g Green value in [0, 1]
12  * \param[out] b Blue value in [0, 1]
13  */
14  void viridis(double s, double &r, double &g, double &b);
15 
16  /** \brief Maps a scalar s in [0, 1] to the Cool-Warm colormap.
17  * \param[in] s Scalar to map.
18  * \param[out] r Red value in [0, 1]
19  * \param[out] g Green value in [0, 1]
20  * \param[out] b Blue value in [0, 1]
21  */
22  void coolwarm(double s, double &r, double &g, double &b);
23 
24  /** \brief Maps a scalar s in [0, 1] to the Extended Kindlmann colormap.
25  * \param[in] s Scalar to map.
26  * \param[out] r Red value in [0, 1]
27  * \param[out] g Green value in [0, 1]
28  * \param[out] b Blue value in [0, 1]
29  */
30  void extKindlmann(double s, double &r, double &g, double &b);
31 
32  /** \brief Maps a scalar s in [0, 1] to the Plasma colormap.
33  * \param[in] s Scalar to map.
34  * \param[out] r Red value in [0, 1]
35  * \param[out] g Green value in [0, 1]
36  * \param[out] b Blue value in [0, 1]
37  */
38  void plasma(double s, double &r, double &g, double &b);
39 
40  /** \brief Maps a scalar s in [0, 1] to the Turbo colormap.
41  * \param[in] s Scalar to map.
42  * \param[out] r Red value in [0, 1]
43  * \param[out] g Green value in [0, 1]
44  * \param[out] b Blue value in [0, 1]
45  */
46  void turbo(double s, double &r, double &g, double &b);
47 
48  /** \brief Maps a scalar s in [0, 1] to greyscale.
49  * \param[in] s Scalar to map.
50  * \param[out] r Red value in [0, 1]
51  * \param[out] g Green value in [0, 1]
52  * \param[out] b Blue value in [0, 1]
53  */
54  void grayscale(double s, double &r, double &g, double &b);
55 
56  /** \brief Maps an RGB color to a greyscale color based on luminosity.
57  * \param[in,out] r Red value in [0, 1]
58  * \param[in,out] g Green value in [0, 1]
59  * \param[in,out] b Blue value in [0, 1]
60  */
61  void toGrayscale(double &r, double &g, double &b);
62 
63  /** \brief Convert a RGB color to HSV.
64  * \param[in] r Red value in [0, 1]
65  * \param[in] g Green value in [0, 1]
66  * \param[in] b Blue value in [0, 1]
67  * \param[out] h Hue value in [-pi, pi]
68  * \param[out] s Saturation value in [0, 1]
69  * \param[out] v Value in [0, 1]
70  */
71  void rgb2hsv(double r, double g, double b, double &h, double &s, double &v);
72 
73  /** \brief Convert a RGB color to HSV.
74  * \param[in] h Hue value in [-pi, pi]
75  * \param[in] s Saturation value in [0, 1]
76  * \param[in] v Value in [0, 1]
77  * \param[out] r Red value in [0, 1]
78  * \param[out] g Green value in [0, 1]
79  * \param[out] b Blue value in [0, 1]
80  */
81  void hsv2rgb(double h, double s, double v, double &r, double &g, double &b);
82 } // namespace se2ez
83 
84 #endif
void plasma(double s, double &r, double &g, double &b)
Maps a scalar s in [0, 1] to the Plasma colormap.
Definition: colormap.cpp:324
void extKindlmann(double s, double &r, double &g, double &b)
Maps a scalar s in [0, 1] to the Extended Kindlmann colormap.
Definition: colormap.cpp:319
void viridis(double s, double &r, double &g, double &b)
Maps a scalar s in [0, 1] to the Viridis colormap.
Definition: colormap.cpp:309
void coolwarm(double s, double &r, double &g, double &b)
Maps a scalar s in [0, 1] to the Cool-Warm colormap.
Definition: colormap.cpp:314
void grayscale(double s, double &r, double &g, double &b)
Maps a scalar s in [0, 1] to greyscale.
Definition: colormap.cpp:334
void turbo(double s, double &r, double &g, double &b)
Maps a scalar s in [0, 1] to the Turbo colormap.
Definition: colormap.cpp:329
void hsv2rgb(double h, double s, double v, double &r, double &g, double &b)
Convert a RGB color to HSV.
Definition: colormap.cpp:387
Main namespace.
Definition: collision.h:11
void rgb2hsv(double r, double g, double b, double &h, double &s, double &v)
Convert a RGB color to HSV.
Definition: colormap.cpp:347
void toGrayscale(double &r, double &g, double &b)
Maps an RGB color to a greyscale color based on luminosity.
Definition: colormap.cpp:341