Point Cloud Library (PCL)  1.11.1-dev
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 #pragma once
39 
40 #include <pcl/pcl_macros.h>
41 #include <pcl/point_types.h>
42 
43 namespace pcl
44 {
45 
46  PCL_EXPORTS RGB
47  getRandomColor (double min = 0.2, double max = 2.8);
48 
50  {
51  /** Color lookup table consisting of 256 colors structured in a maximally
52  * discontinuous manner. Generated using the method of Glasbey et al.
53  * (see https://github.com/taketwo/glasbey) */
55  /** A perceptually uniform colormap created by Stéfan van der Walt and
56  * Nathaniel Smith for the Python matplotlib library.
57  * (see https://youtu.be/xAoljeRJ3lU for background and overview) */
59  };
60 
61  template <ColorLUTName T>
62  class ColorLUT
63  {
64 
65  public:
66 
67  /** Get a color from the lookup table with a given id.
68  *
69  * The id should be less than the size of the LUT (see size()). */
70  static RGB at (std::size_t color_id);
71 
72  /** Get the number of colors in the lookup table.
73  *
74  * Note: the number of colors is different from the number of elements
75  * in the lookup table (each color is defined by three bytes). */
76  static std::size_t size ();
77 
78  /** Get a raw pointer to the lookup table. */
79  static const unsigned char* data ();
80 
81  };
82 
85 
86 }
pcl_macros.h
Defines all the PCL and non-PCL macros used.
pcl
Definition: convolution.h:46
point_types.h
pcl::LUT_GLASBEY
@ LUT_GLASBEY
Color lookup table consisting of 256 colors structured in a maximally discontinuous manner.
Definition: colors.h:54
pcl::ColorLUT
Definition: colors.h:62
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:58
pcl::RGB
A structure representing RGB color information.
Definition: point_types.hpp:345
pcl::ColorLUT::at
static RGB at(std::size_t color_id)
Get a color from the lookup table with a given id.
pcl::ColorLUTName
ColorLUTName
Definition: colors.h:49
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)
pcl::ColorLUT::size
static std::size_t size()
Get the number of colors in the lookup table.
PCL_EXPORTS
#define PCL_EXPORTS
Definition: pcl_macros.h:323