Point Cloud Library (PCL)  1.9.1
colors.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2014-, Open Perception, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the copyright holder(s) nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #ifndef PCL_COMMON_COLORS_H
39 #define PCL_COMMON_COLORS_H
40 
41 #include <pcl/pcl_macros.h>
42 #include <pcl/point_types.h>
43 
44 namespace pcl
45 {
46 
47  PCL_EXPORTS RGB
48  getRandomColor (double min = 0.2, double max = 2.8);
49 
51  {
52  /** Color lookup table consisting of 256 colors structured in a maximally
53  * discontinuous manner. Generated using the method of Glasbey et al.
54  * (see https://github.com/taketwo/glasbey) */
56  /** A perceptually uniform colormap created by Stéfan van der Walt and
57  * Nathaniel Smith for the Python matplotlib library.
58  * (see https://youtu.be/xAoljeRJ3lU for background and overview) */
60  };
61 
62  template <ColorLUTName T>
63  class ColorLUT
64  {
65 
66  public:
67 
68  /** Get a color from the lookup table with a given id.
69  *
70  * The id should be less than the size of the LUT (see size()). */
71  static RGB at (size_t color_id);
72 
73  /** Get the number of colors in the lookup table.
74  *
75  * Note: the number of colors is different from the number of elements
76  * in the lookup table (each color is defined by three bytes). */
77  static size_t size ();
78 
79  /** Get a raw pointer to the lookup table. */
80  static const unsigned char* data ();
81 
82  };
83 
86 
87 }
88 
89 #endif /* PCL_COMMON_COLORS_H */
90 
pcl::ColorLUT::size
static size_t size()
Get the number of colors in the lookup table.
pcl
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
point_types.h
pcl::GlasbeyLUT
ColorLUT< pcl::LUT_GLASBEY > GlasbeyLUT
Definition: colors.h:84
pcl::ViridisLUT
ColorLUT< pcl::LUT_VIRIDIS > ViridisLUT
Definition: colors.h:85
pcl::LUT_GLASBEY
@ LUT_GLASBEY
Color lookup table consisting of 256 colors structured in a maximally discontinuous manner.
Definition: colors.h:55
pcl::ColorLUT
Definition: colors.h:63
pcl::ColorLUT::at
static RGB at(size_t color_id)
Get a color from the lookup table with a given id.
pcl::LUT_VIRIDIS
@ LUT_VIRIDIS
A perceptually uniform colormap created by Stéfan van der Walt and Nathaniel Smith for the Python mat...
Definition: colors.h:59
pcl::RGB
A structure representing RGB color information.
Definition: point_types.hpp:339
pcl::ColorLUTName
ColorLUTName
Definition: colors.h:50
pcl::ColorLUT::data
static const unsigned char * data()
Get a raw pointer to the lookup table.
pcl::getRandomColor
PCL_EXPORTS RGB getRandomColor(double min=0.2, double max=2.8)