1 #ifndef CVD_INC_COLOURMAPS_H 2 #define CVD_INC_COLOURMAPS_H 4 #include <cvd/internal/convert_pixel_types.h> 5 #include <cvd/internal/rgb_components.h> 16 Rgb<float> grey(
float d)
20 d = max(0.f, min(d, 1.0f));
21 return Rgb<float>(d, d, d);
24 Rgb<float> hot(
float d)
28 d = max(0.f, min(d, 1.0f));
31 return Rgb<float>(d * 3, 0, 0);
33 return Rgb<float>(1, (d - 1. / 3.) * 3, 0);
35 return Rgb<float>(1, 1, (d - 2. / 3.) * 3);
38 Rgb<float> jet(
float d)
42 d = max(0.f, min(d, 1.0f));
43 double r = 0, g = 0, b = 0;
54 r = 1 - (d - 1. / 4.) / (1. / 4.);
61 b = (d - 2. / 4.) / (1. / 4.);
66 g = 1 - (d - 3. / 4.) / (1. / 4.);
70 return Rgb<float>(r, g, b);
73 Rgb<float> gkr(
float d)
79 return Rgb<float>(1 - d * 2, 0, 0);
81 return Rgb<float>(0, (d - 1. / 2.) * 2, 0);
84 template <
class C,
class D>
85 Rgb<C> conv(
const D& func,
float d)
87 Rgb<float> col = func(d);
89 Pixel::ConvertPixels<Rgb<float>, Rgb<C>>::convert(&col, &r, 1);
109 static Rgb<C> hot(
double d) {
return Internal::conv<C>(Internal::hot, d); }
113 static Rgb<C> jet(
double d) {
return Internal::conv<C>(Internal::jet, d); }
117 static Rgb<C> gkr(
double d) {
return Internal::conv<C>(Internal::gkr, d); }
120 static Rgb<C> grey(
double d) {
return Internal::conv<C>(Internal::grey, d); }
A colour consisting of red, green and blue components.
Definition: rgb.h:25
static Rgb< C > jet(double d)
Jet colourscale (red-yellow-green-cyan-blue)
Definition: colourmap.h:113
All classes and functions are within the CVD namespace.
Definition: argb.h:6
Definition: colourmap.h:95
static Rgb< C > grey(double d)
Gray colourscale.
Definition: colourmap.h:120
static Rgb< C > hot(double d)
Glow/Hot colourscale (red-yellow-white)
Definition: colourmap.h:109
static Rgb< C > gkr(double d)
Green-black-red colourscale.
Definition: colourmap.h:117