40 #include <pcl/pcl_macros.h>
41 #include <pcl/point_types.h>
43 #include <type_traits>
64 template <ColorLUTName T>
73 static RGB at (std::size_t color_id);
79 static std::size_t
size ();
82 static const unsigned char*
data ();
100 template <
typename T, std::u
int8_t bits = 8>
101 PCL_EXPORTS
inline std::array<T, 1 << bits>
104 static_assert(std::is_floating_point<T>::value,
"LUT value must be a floating point");
106 constexpr
const std::size_t size = 1 << bits;
108 static const auto sRGB_LUT = [&]() {
110 std::array<T, 1 << bits> LUT;
111 for (std::size_t i = 0; i < size; ++i) {
112 T f =
static_cast<T
>(i) / static_cast<T>(size - 1);
115 LUT[i] =
static_cast<T
>(
116 std::pow((f + static_cast<T>(0.055)) / static_cast<T>(1.055),
117 static_cast<T>(2.4)));
121 LUT[i] = f /
static_cast<T
>(12.92);
146 template <
typename T, std::
size_t discretizations = 4000>
147 PCL_EXPORTS
inline const std::array<T, discretizations>&
150 static_assert(std::is_floating_point<T>::value,
"LUT value must be a floating point");
152 static const auto f_LUT = [&]() {
153 std::array<T, discretizations> LUT;
154 for (std::size_t i = 0; i < discretizations; ++i) {
155 T f =
static_cast<T
>(i) / static_cast<T>(discretizations);
156 if (f > static_cast<T>(0.008856)) {
158 LUT[i] =
static_cast<T
>(std::pow(f, (static_cast<T>(1) / static_cast<T>(3))));
163 static_cast<T
>(7.87) * f + (
static_cast<T
>(16) / static_cast<T>(116));
A perceptually uniform colormap created by Stéfan van der Walt and Nathaniel Smith for the Python mat...
static RGB at(std::size_t color_id)
Get a color from the lookup table with a given id.
static const unsigned char * data()
Get a raw pointer to the lookup table.
static std::size_t size()
Get the number of colors in the lookup table.
A structure representing RGB color information.
PCL_EXPORTS const std::array< T, discretizations > & XYZ2LAB_LUT() noexcept
Returns a Look-Up Table useful in converting scaled CIE XYZ into CIE L*a*b*.
PCL_EXPORTS std::array< T, 1<< bits > RGB2sRGB_LUT() noexcept
Returns a Look-Up Table useful in converting RGB to sRGB.
PCL_EXPORTS RGB getRandomColor(double min=0.2, double max=2.8)
Color lookup table consisting of 256 colors structured in a maximally discontinuous manner...