colormap.cpp
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
31 #ifndef _colormap_CPP_
32 #define _colormap_CPP_
33 
42 #include <colormap/colormap.h>
43 
44 
46 
47 std_msgs::ColorRGBA class_colormap::color(int i)
48 {
49 
50  if (i<0)
51  {
52  std_msgs::ColorRGBA c;
53  c.r = 0;
54  c.g=0;
55  c.b=0.6;
56  c.a=1;
57  return c;
58  }
59  else
60  return cm[i%max_index];
61 }
62 
63 cv::Scalar class_colormap::cv_color(int i)
64 {
65  std_msgs::ColorRGBA c;
66 
67  if (i<0)
68  {
69  c.r = 0;
70  c.g=0;
71  c.b=0.6;
72  c.a=1;
73  }
74  else
75  {
76  c = color(i);
77  }
78 
79  cv::Scalar s;
80  s.val[0] = c.b*255;
81  s.val[1] = c.g*255;
82  s.val[2] = c.r*255;
83  return s;
84 }
85 
86 
87 class_colormap::class_colormap(std::string name, int total, float alfa, bool reverse)
88 {
89  if(name=="jet")
90  init_colormap_jet(total, alfa, reverse);
91  else if(name=="hsv")
92  init_colormap_hsv(total, alfa, reverse);
93  else if(name=="hot")
94  init_colormap_hot(total, alfa, reverse);
95  else if(name=="cool")
96  init_colormap_cool(total, alfa, reverse);
97  else if(name=="spring")
98  init_colormap_spring(total, alfa, reverse);
99  else if(name=="summer")
100  init_colormap_summer(total, alfa, reverse);
101  else if(name=="autumn")
102  init_colormap_autumn(total, alfa, reverse);
103  else if(name=="winter")
104  init_colormap_winter(total, alfa, reverse);
105  else if(name=="gray")
106  init_colormap_gray(total, alfa, reverse);
107  else if(name=="bone")
108  init_colormap_bone(total, alfa, reverse);
109  else if(name=="copper")
110  init_colormap_copper(total, alfa, reverse);
111  else if(name=="pink")
112  init_colormap_pink(total, alfa, reverse);
113  else if(name=="lines")
114  init_colormap_lines(total, alfa, reverse);
115  else
116  {
117  ROS_ERROR("Unknown colormap %s. Using default hot.", name.c_str());
118  init_colormap_hot(total, alfa, reverse);
119  }
120 }
121 
122 int class_colormap::setup_colormap(int total, float alfa, bool reverse, float* r, float* g, float* b)
123 {
124  if (total>64){total=64; ROS_WARN("Color map: maximum total colors in color map is 64.");}
125  max_index = total;
126 
127  std_msgs::ColorRGBA color;
128  color.a = alfa;
129 
130  double factor = 64./(double)total;
131  for (int i=0; 1; i++)
132  {
133  int index = (int)((double)i*factor);
134 
135  color.r = r[index];
136  color.g = g[index];
137  color.b = b[index];
138  cm.push_back(color);
139 
140  if((int)cm.size()>=total)
141  break;
142  }
143 
144  if (reverse) std::reverse(cm.begin(),cm.end());
145 
146  return 1;
147 }
148 
149 //ALL THE COLORMAPS TAKEN FROM MATLAB
150 int class_colormap::init_colormap_jet(int total, float alfa, bool reverse)
151 {
152  float r[64]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9375, 0.875, 0.8125, 0.75, 0.6875, 0.625, 0.5625, 0.5};
153  float g[64]={0, 0, 0, 0, 0, 0, 0, 0, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9375, 0.875, 0.8125, 0.75, 0.6875, 0.625, 0.5625, 0.5, 0.4375, 0.375, 0.3125, 0.25, 0.1875, 0.125, 0.0625, 0, 0, 0, 0, 0, 0, 0, 0, 0};
154  float b[64]={0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9375, 0.875, 0.8125, 0.75, 0.6875, 0.625, 0.5625, 0.5, 0.4375, 0.375, 0.3125, 0.25, 0.1875, 0.125, 0.0625, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
155  return setup_colormap(total, alfa, reverse, r, g, b);
156 }
157 
158 int class_colormap::init_colormap_hsv(int total, float alfa, bool reverse)
159 {
160  float r[64]={1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96875, 0.875, 0.78125, 0.6875, 0.59375, 0.5, 0.40625, 0.3125, 0.21875, 0.125, 0.03125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03125, 0.125, 0.21875, 0.3125, 0.40625, 0.5, 0.59375, 0.6875, 0.78125, 0.875, 0.96875, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
161  float g[64]={0, 0.09375, 0.1875, 0.28125, 0.375, 0.46875, 0.5625, 0.65625, 0.75, 0.84375, 0.9375, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90625, 0.8125, 0.71875, 0.625, 0.53125, 0.4375, 0.34375, 0.25, 0.15625, 0.0625, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
162  float b[64]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0625, 0.15625, 0.25, 0.34375, 0.4375, 0.53125, 0.625, 0.71875, 0.8125, 0.90625, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9375, 0.84375, 0.75, 0.65625, 0.5625, 0.46875, 0.375, 0.28125, 0.1875, 1};
163  return setup_colormap(total, alfa, reverse, r, g, b);
164 }
165 
166 int class_colormap::init_colormap_hot(int total, float alfa, bool reverse)
167 {
168  float r[64]={0.041667, 0.083333, 0.125, 0.16667, 0.20833, 0.25, 0.29167, 0.33333, 0.375, 0.41667, 0.45833, 0.5, 0.54167, 0.58333, 0.625, 0.66667, 0.70833, 0.75, 0.79167, 0.83333, 0.875, 0.91667, 0.95833, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
169 
170  float g[64]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.041667, 0.083333, 0.125, 0.16667, 0.20833, 0.25, 0.29167, 0.33333, 0.375, 0.41667, 0.45833, 0.5, 0.54167, 0.58333, 0.625, 0.66667, 0.70833, 0.75, 0.79167, 0.83333, 0.875, 0.91667, 0.95833, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.125};
171 
172  float b[64]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 0.041667};
173 
174  return setup_colormap(total, alfa, reverse, r, g, b);
175 }
176 
177 int class_colormap::init_colormap_cool(int total, float alfa, bool reverse)
178 {
179  float r[64]={0, 0.015873, 0.031746, 0.047619, 0.063492, 0.079365, 0.095238, 0.11111, 0.12698, 0.14286, 0.15873, 0.1746, 0.19048, 0.20635, 0.22222, 0.2381, 0.25397, 0.26984, 0.28571, 0.30159, 0.31746, 0.33333, 0.34921, 0.36508, 0.38095, 0.39683, 0.4127, 0.42857, 0.44444, 0.46032, 0.47619, 0.49206, 0.50794, 0.52381, 0.53968, 0.55556, 0.57143, 0.5873, 0.60317, 0.61905, 0.63492, 0.65079, 0.66667, 0.68254, 0.69841, 0.71429, 0.73016, 0.74603, 0.7619, 0.77778, 0.79365, 0.80952, 0.8254, 0.84127, 0.85714, 0.87302, 0.88889, 0.90476, 0.92063, 0.93651, 0.95238, 0.96825, 0.98413, 1};
180  float g[64]={1, 0.98413, 0.96825, 0.95238, 0.93651, 0.92063, 0.90476, 0.88889, 0.87302, 0.85714, 0.84127, 0.8254, 0.80952, 0.79365, 0.77778, 0.7619, 0.74603, 0.73016, 0.71429, 0.69841, 0.68254, 0.66667, 0.65079, 0.63492, 0.61905, 0.60317, 0.5873, 0.57143, 0.55556, 0.53968, 0.52381, 0.50794, 0.49206, 0.47619, 0.46032, 0.44444, 0.42857, 0.4127, 0.39683, 0.38095, 0.36508, 0.34921, 0.33333, 0.31746, 0.30159, 0.28571, 0.26984, 0.25397, 0.2381, 0.22222, 0.20635, 0.19048, 0.1746, 0.15873, 0.14286, 0.12698, 0.11111, 0.095238, 0.079365, 0.063492, 0.047619, 0.031746, 0.015873, 0.031746};
181  float b[64]={1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0};
182  return setup_colormap(total, alfa, reverse, r, g, b);
183 }
184 
185 int class_colormap::init_colormap_spring(int total, float alfa, bool reverse)
186 {
187  float r[64]={1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
188  float g[64]={0, 0.015873, 0.031746, 0.047619, 0.063492, 0.079365, 0.095238, 0.11111, 0.12698, 0.14286, 0.15873, 0.1746, 0.19048, 0.20635, 0.22222, 0.2381, 0.25397, 0.26984, 0.28571, 0.30159, 0.31746, 0.33333, 0.34921, 0.36508, 0.38095, 0.39683, 0.4127, 0.42857, 0.44444, 0.46032, 0.47619, 0.49206, 0.50794, 0.52381, 0.53968, 0.55556, 0.57143, 0.5873, 0.60317, 0.61905, 0.63492, 0.65079, 0.66667, 0.68254, 0.69841, 0.71429, 0.73016, 0.74603, 0.7619, 0.77778, 0.79365, 0.80952, 0.8254, 0.84127, 0.85714, 0.87302, 0.88889, 0.90476, 0.92063, 0.93651, 0.95238, 0.96825, 0.98413, 1};
189  float b[64]={1, 0.98413, 0.96825, 0.95238, 0.93651, 0.92063, 0.90476, 0.88889, 0.87302, 0.85714, 0.84127, 0.8254, 0.80952, 0.79365, 0.77778, 0.7619, 0.74603, 0.73016, 0.71429, 0.69841, 0.68254, 0.66667, 0.65079, 0.63492, 0.61905, 0.60317, 0.5873, 0.57143, 0.55556, 0.53968, 0.52381, 0.50794, 0.49206, 0.47619, 0.46032, 0.44444, 0.42857, 0.4127, 0.39683, 0.38095, 0.36508, 0.34921, 0.33333, 0.31746, 0.30159, 0.28571, 0.26984, 0.25397, 0.2381, 0.22222, 0.20635, 0.19048, 0.1746, 0.15873, 0.14286, 0.12698, 0.11111, 0.095238, 0.079365, 0.063492, 0.047619, 0.031746, 0.015873, 1};
190 
191  return setup_colormap(total, alfa, reverse, r, g, b);
192 }
193 
194 int class_colormap::init_colormap_summer(int total, float alfa, bool reverse)
195 {
196  float r[64]={0, 0.015873, 0.031746, 0.047619, 0.063492, 0.079365, 0.095238, 0.11111, 0.12698, 0.14286, 0.15873, 0.1746, 0.19048, 0.20635, 0.22222, 0.2381, 0.25397, 0.26984, 0.28571, 0.30159, 0.31746, 0.33333, 0.34921, 0.36508, 0.38095, 0.39683, 0.4127, 0.42857, 0.44444, 0.46032, 0.47619, 0.49206, 0.50794, 0.52381, 0.53968, 0.55556, 0.57143, 0.5873, 0.60317, 0.61905, 0.63492, 0.65079, 0.66667, 0.68254, 0.69841, 0.71429, 0.73016, 0.74603, 0.7619, 0.77778, 0.79365, 0.80952, 0.8254, 0.84127, 0.85714, 0.87302, 0.88889, 0.90476, 0.92063, 0.93651, 0.95238, 0.96825, 0.98413, 1};
197  float g[64]={0.5, 0.50794, 0.51587, 0.52381, 0.53175, 0.53968, 0.54762, 0.55556, 0.56349, 0.57143, 0.57937, 0.5873, 0.59524, 0.60317, 0.61111, 0.61905, 0.62698, 0.63492, 0.64286, 0.65079, 0.65873, 0.66667, 0.6746, 0.68254, 0.69048, 0.69841, 0.70635, 0.71429, 0.72222, 0.73016, 0.7381, 0.74603, 0.75397, 0.7619, 0.76984, 0.77778, 0.78571, 0.79365, 0.80159, 0.80952, 0.81746, 0.8254, 0.83333, 0.84127, 0.84921, 0.85714, 0.86508, 0.87302, 0.88095, 0.88889, 0.89683, 0.90476, 0.9127, 0.92063, 0.92857, 0.93651, 0.94444, 0.95238, 0.96032, 0.96825, 0.97619, 0.98413, 0.99206, 0.031746};
198  float b[64]={0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0};
199 
200  return setup_colormap(total, alfa, reverse, r, g, b);
201 }
202 
203 int class_colormap::init_colormap_autumn(int total, float alfa, bool reverse)
204 {
205  float r[64]={1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
206  float g[64]={0, 0.015873, 0.031746, 0.047619, 0.063492, 0.079365, 0.095238, 0.11111, 0.12698, 0.14286, 0.15873, 0.1746, 0.19048, 0.20635, 0.22222, 0.2381, 0.25397, 0.26984, 0.28571, 0.30159, 0.31746, 0.33333, 0.34921, 0.36508, 0.38095, 0.39683, 0.4127, 0.42857, 0.44444, 0.46032, 0.47619, 0.49206, 0.50794, 0.52381, 0.53968, 0.55556, 0.57143, 0.5873, 0.60317, 0.61905, 0.63492, 0.65079, 0.66667, 0.68254, 0.69841, 0.71429, 0.73016, 0.74603, 0.7619, 0.77778, 0.79365, 0.80952, 0.8254, 0.84127, 0.85714, 0.87302, 0.88889, 0.90476, 0.92063, 0.93651, 0.95238, 0.96825, 0.98413, 1};
207  float b[64]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
208 
209  return setup_colormap(total, alfa, reverse, r, g, b);
210 }
211 
212 int class_colormap::init_colormap_winter(int total, float alfa, bool reverse)
213 {
214  float r[64]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
215  float g[64]={0, 0.015873, 0.031746, 0.047619, 0.063492, 0.079365, 0.095238, 0.11111, 0.12698, 0.14286, 0.15873, 0.1746, 0.19048, 0.20635, 0.22222, 0.2381, 0.25397, 0.26984, 0.28571, 0.30159, 0.31746, 0.33333, 0.34921, 0.36508, 0.38095, 0.39683, 0.4127, 0.42857, 0.44444, 0.46032, 0.47619, 0.49206, 0.50794, 0.52381, 0.53968, 0.55556, 0.57143, 0.5873, 0.60317, 0.61905, 0.63492, 0.65079, 0.66667, 0.68254, 0.69841, 0.71429, 0.73016, 0.74603, 0.7619, 0.77778, 0.79365, 0.80952, 0.8254, 0.84127, 0.85714, 0.87302, 0.88889, 0.90476, 0.92063, 0.93651, 0.95238, 0.96825, 0.98413, 0};
216  float b[64]={1, 0.99206, 0.98413, 0.97619, 0.96825, 0.96032, 0.95238, 0.94444, 0.93651, 0.92857, 0.92063, 0.9127, 0.90476, 0.89683, 0.88889, 0.88095, 0.87302, 0.86508, 0.85714, 0.84921, 0.84127, 0.83333, 0.8254, 0.81746, 0.80952, 0.80159, 0.79365, 0.78571, 0.77778, 0.76984, 0.7619, 0.75397, 0.74603, 0.7381, 0.73016, 0.72222, 0.71429, 0.70635, 0.69841, 0.69048, 0.68254, 0.6746, 0.66667, 0.65873, 0.65079, 0.64286, 0.63492, 0.62698, 0.61905, 0.61111, 0.60317, 0.59524, 0.5873, 0.57937, 0.57143, 0.56349, 0.55556, 0.54762, 0.53968, 0.53175, 0.52381, 0.51587, 0.50794, 0};
217 
218  return setup_colormap(total, alfa, reverse, r, g, b);
219 }
220 
221 int class_colormap::init_colormap_gray(int total, float alfa, bool reverse)
222 {
223  float r[64]={0, 0.015873, 0.031746, 0.047619, 0.063492, 0.079365, 0.095238, 0.11111, 0.12698, 0.14286, 0.15873, 0.1746, 0.19048, 0.20635, 0.22222, 0.2381, 0.25397, 0.26984, 0.28571, 0.30159, 0.31746, 0.33333, 0.34921, 0.36508, 0.38095, 0.39683, 0.4127, 0.42857, 0.44444, 0.46032, 0.47619, 0.49206, 0.50794, 0.52381, 0.53968, 0.55556, 0.57143, 0.5873, 0.60317, 0.61905, 0.63492, 0.65079, 0.66667, 0.68254, 0.69841, 0.71429, 0.73016, 0.74603, 0.7619, 0.77778, 0.79365, 0.80952, 0.8254, 0.84127, 0.85714, 0.87302, 0.88889, 0.90476, 0.92063, 0.93651, 0.95238, 0.96825, 0.98413, 1};
224  float g[64]={0, 0.015873, 0.031746, 0.047619, 0.063492, 0.079365, 0.095238, 0.11111, 0.12698, 0.14286, 0.15873, 0.1746, 0.19048, 0.20635, 0.22222, 0.2381, 0.25397, 0.26984, 0.28571, 0.30159, 0.31746, 0.33333, 0.34921, 0.36508, 0.38095, 0.39683, 0.4127, 0.42857, 0.44444, 0.46032, 0.47619, 0.49206, 0.50794, 0.52381, 0.53968, 0.55556, 0.57143, 0.5873, 0.60317, 0.61905, 0.63492, 0.65079, 0.66667, 0.68254, 0.69841, 0.71429, 0.73016, 0.74603, 0.7619, 0.77778, 0.79365, 0.80952, 0.8254, 0.84127, 0.85714, 0.87302, 0.88889, 0.90476, 0.92063, 0.93651, 0.95238, 0.96825, 0.98413, 0.031746};
225  float b[64]={0, 0.015873, 0.031746, 0.047619, 0.063492, 0.079365, 0.095238, 0.11111, 0.12698, 0.14286, 0.15873, 0.1746, 0.19048, 0.20635, 0.22222, 0.2381, 0.25397, 0.26984, 0.28571, 0.30159, 0.31746, 0.33333, 0.34921, 0.36508, 0.38095, 0.39683, 0.4127, 0.42857, 0.44444, 0.46032, 0.47619, 0.49206, 0.50794, 0.52381, 0.53968, 0.55556, 0.57143, 0.5873, 0.60317, 0.61905, 0.63492, 0.65079, 0.66667, 0.68254, 0.69841, 0.71429, 0.73016, 0.74603, 0.7619, 0.77778, 0.79365, 0.80952, 0.8254, 0.84127, 0.85714, 0.87302, 0.88889, 0.90476, 0.92063, 0.93651, 0.95238, 0.96825, 0.98413, 0};
226 
227  return setup_colormap(total, alfa, reverse, r, g, b);
228 }
229 
230 int class_colormap::init_colormap_bone(int total, float alfa, bool reverse)
231 {
232  float r[64]={0, 0.013889, 0.027778, 0.041667, 0.055556, 0.069444, 0.083333, 0.097222, 0.11111, 0.125, 0.13889, 0.15278, 0.16667, 0.18056, 0.19444, 0.20833, 0.22222, 0.23611, 0.25, 0.26389, 0.27778, 0.29167, 0.30556, 0.31944, 0.33333, 0.34722, 0.36111, 0.375, 0.38889, 0.40278, 0.41667, 0.43056, 0.44444, 0.45833, 0.47222, 0.48611, 0.5, 0.51389, 0.52778, 0.54167, 0.55556, 0.56944, 0.58333, 0.59722, 0.61111, 0.625, 0.63889, 0.65278, 0.67448, 0.69618, 0.71788, 0.73958, 0.76128, 0.78299, 0.80469, 0.82639, 0.84809, 0.86979, 0.89149, 0.91319, 0.9349, 0.9566, 0.9783, 1};
233  float g[64]={0, 0.013889, 0.027778, 0.041667, 0.055556, 0.069444, 0.083333, 0.097222, 0.11111, 0.125, 0.13889, 0.15278, 0.16667, 0.18056, 0.19444, 0.20833, 0.22222, 0.23611, 0.25, 0.26389, 0.27778, 0.29167, 0.30556, 0.31944, 0.33854, 0.35764, 0.37674, 0.39583, 0.41493, 0.43403, 0.45312, 0.47222, 0.49132, 0.51042, 0.52951, 0.54861, 0.56771, 0.58681, 0.6059, 0.625, 0.6441, 0.66319, 0.68229, 0.70139, 0.72049, 0.73958, 0.75868, 0.77778, 0.79167, 0.80556, 0.81944, 0.83333, 0.84722, 0.86111, 0.875, 0.88889, 0.90278, 0.91667, 0.93056, 0.94444, 0.95833, 0.97222, 0.98611, 0.027778};
234  float b[64]={0.0052083, 0.024306, 0.043403, 0.0625, 0.081597, 0.10069, 0.11979, 0.13889, 0.15799, 0.17708, 0.19618, 0.21528, 0.23438, 0.25347, 0.27257, 0.29167, 0.31076, 0.32986, 0.34896, 0.36806, 0.38715, 0.40625, 0.42535, 0.44444, 0.45833, 0.47222, 0.48611, 0.5, 0.51389, 0.52778, 0.54167, 0.55556, 0.56944, 0.58333, 0.59722, 0.61111, 0.625, 0.63889, 0.65278, 0.66667, 0.68056, 0.69444, 0.70833, 0.72222, 0.73611, 0.75, 0.76389, 0.77778, 0.79167, 0.80556, 0.81944, 0.83333, 0.84722, 0.86111, 0.875, 0.88889, 0.90278, 0.91667, 0.93056, 0.94444, 0.95833, 0.97222, 0.98611, 0};
235 
236  return setup_colormap(total, alfa, reverse, r, g, b);
237 }
238 
239 int class_colormap::init_colormap_copper(int total, float alfa, bool reverse)
240 {
241  float r[64]={0, 0.019841, 0.039683, 0.059524, 0.079365, 0.099206, 0.11905, 0.13889, 0.15873, 0.17857, 0.19841, 0.21825, 0.2381, 0.25794, 0.27778, 0.29762, 0.31746, 0.3373, 0.35714, 0.37698, 0.39683, 0.41667, 0.43651, 0.45635, 0.47619, 0.49603, 0.51587, 0.53571, 0.55556, 0.5754, 0.59524, 0.61508, 0.63492, 0.65476, 0.6746, 0.69444, 0.71429, 0.73413, 0.75397, 0.77381, 0.79365, 0.81349, 0.83333, 0.85317, 0.87302, 0.89286, 0.9127, 0.93254, 0.95238, 0.97222, 0.99206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
242  float g[64]={0, 0.0124, 0.0248, 0.0372, 0.0496, 0.062, 0.0744, 0.0868, 0.0992, 0.1116, 0.124, 0.1364, 0.1488, 0.1612, 0.1736, 0.186, 0.1984, 0.2108, 0.2232, 0.2356, 0.248, 0.2604, 0.2728, 0.2852, 0.2976, 0.31, 0.3224, 0.3348, 0.3472, 0.3596, 0.372, 0.3844, 0.3968, 0.4092, 0.4216, 0.434, 0.4464, 0.4588, 0.4712, 0.4836, 0.496, 0.5084, 0.5208, 0.5332, 0.5456, 0.558, 0.5704, 0.5828, 0.5952, 0.6076, 0.62, 0.6324, 0.6448, 0.6572, 0.6696, 0.682, 0.6944, 0.7068, 0.7192, 0.7316, 0.744, 0.7564, 0.7688, 0.039683};
243  float b[64]={0, 0.0078968, 0.015794, 0.02369, 0.031587, 0.039484, 0.047381, 0.055278, 0.063175, 0.071071, 0.078968, 0.086865, 0.094762, 0.10266, 0.11056, 0.11845, 0.12635, 0.13425, 0.14214, 0.15004, 0.15794, 0.16583, 0.17373, 0.18163, 0.18952, 0.19742, 0.20532, 0.21321, 0.22111, 0.22901, 0.2369, 0.2448, 0.2527, 0.2606, 0.26849, 0.27639, 0.28429, 0.29218, 0.30008, 0.30798, 0.31587, 0.32377, 0.33167, 0.33956, 0.34746, 0.35536, 0.36325, 0.37115, 0.37905, 0.38694, 0.39484, 0.40274, 0.41063, 0.41853, 0.42643, 0.43433, 0.44222, 0.45012, 0.45802, 0.46591, 0.47381, 0.48171, 0.4896, 0};
244 
245  return setup_colormap(total, alfa, reverse, r, g, b);
246 }
247 
248 int class_colormap::init_colormap_pink(int total, float alfa, bool reverse)
249 {
250  float r[64]={0.11785, 0.19586, 0.25066, 0.29547, 0.33432, 0.36911, 0.40089, 0.43033, 0.45788, 0.48387, 0.50853, 0.53204, 0.55456, 0.5762, 0.59706, 0.61721, 0.63673, 0.65566, 0.67407, 0.69198, 0.70944, 0.72648, 0.74313, 0.75942, 0.76636, 0.77323, 0.78004, 0.7868, 0.79349, 0.80013, 0.80672, 0.81325, 0.81973, 0.82616, 0.83254, 0.83887, 0.84515, 0.85139, 0.85758, 0.86373, 0.86984, 0.8759, 0.88192, 0.8879, 0.89384, 0.89974, 0.9056, 0.91142, 0.91721, 0.92296, 0.92867, 0.93435, 0.94, 0.94561, 0.95119, 0.95674, 0.96225, 0.96773, 0.97319, 0.97861, 0.984, 0.98936, 0.99469, 1};
251  float g[64]={0, 0.10287, 0.14548, 0.17817, 0.20574, 0.23002, 0.25198, 0.27217, 0.29096, 0.30861, 0.3253, 0.34118, 0.35635, 0.3709, 0.3849, 0.39841, 0.41148, 0.42414, 0.43644, 0.4484, 0.46004, 0.4714, 0.4825, 0.49334, 0.51755, 0.54067, 0.56285, 0.58418, 0.60477, 0.62467, 0.64396, 0.66269, 0.6809, 0.69864, 0.71594, 0.73283, 0.74934, 0.76549, 0.78131, 0.79682, 0.81203, 0.82696, 0.84163, 0.85604, 0.87022, 0.88416, 0.8979, 0.91142, 0.91721, 0.92296, 0.92867, 0.93435, 0.94, 0.94561, 0.95119, 0.95674, 0.96225, 0.96773, 0.97319, 0.97861, 0.984, 0.98936, 0.99469, 0.25066};
252  float b[64]={0, 0.10287, 0.14548, 0.17817, 0.20574, 0.23002, 0.25198, 0.27217, 0.29096, 0.30861, 0.3253, 0.34118, 0.35635, 0.3709, 0.3849, 0.39841, 0.41148, 0.42414, 0.43644, 0.4484, 0.46004, 0.4714, 0.4825, 0.49334, 0.50395, 0.51434, 0.52453, 0.53452, 0.54433, 0.55397, 0.56344, 0.57275, 0.58191, 0.59094, 0.59982, 0.60858, 0.61721, 0.62573, 0.63413, 0.64242, 0.6506, 0.65868, 0.66667, 0.67456, 0.68236, 0.69007, 0.69769, 0.70523, 0.72717, 0.74846, 0.76916, 0.78931, 0.80897, 0.82816, 0.84691, 0.86526, 0.88323, 0.90084, 0.91811, 0.93506, 0.95171, 0.96808, 0.98417, 0.11785};
253 
254  return setup_colormap(total, alfa, reverse, r, g, b);
255 }
256 
257 int class_colormap::init_colormap_lines(int total, float alfa, bool reverse)
258 {
259  float r[64]={0, 0, 1, 0, 0.75, 0.75, 0.25, 0, 0, 1, 0, 0.75, 0.75, 0.25, 0, 0, 1, 0, 0.75, 0.75, 0.25, 0, 0, 1, 0, 0.75, 0.75, 0.25, 0, 0, 1, 0, 0.75, 0.75, 0.25, 0, 0, 1, 0, 0.75, 0.75, 0.25, 0, 0, 1, 0, 0.75, 0.75, 0.25, 0, 0, 1, 0, 0.75, 0.75, 0.25, 0, 0, 1, 0, 0.75, 0.75, 0.25, 0};
260  float g[64]={0, 0.5, 0, 0.75, 0, 0.75, 0.25, 0, 0.5, 0, 0.75, 0, 0.75, 0.25, 0, 0.5, 0, 0.75, 0, 0.75, 0.25, 0, 0.5, 0, 0.75, 0, 0.75, 0.25, 0, 0.5, 0, 0.75, 0, 0.75, 0.25, 0, 0.5, 0, 0.75, 0, 0.75, 0.25, 0, 0.5, 0, 0.75, 0, 0.75, 0.25, 0, 0.5, 0, 0.75, 0, 0.75, 0.25, 0, 0.5, 0, 0.75, 0, 0.75, 0.25, 1};
261  float b[64]={1, 0, 0, 0.75, 0.75, 0, 0.25, 1, 0, 0, 0.75, 0.75, 0, 0.25, 1, 0, 0, 0.75, 0.75, 0, 0.25, 1, 0, 0, 0.75, 0.75, 0, 0.25, 1, 0, 0, 0.75, 0.75, 0, 0.25, 1, 0, 0, 0.75, 0.75, 0, 0.25, 1, 0, 0, 0.75, 0.75, 0, 0.25, 1, 0, 0, 0.75, 0.75, 0, 0.25, 1, 0, 0, 0.75, 0.75, 0, 0.25, 0};
262 
263  return setup_colormap(total, alfa, reverse, r, g, b);
264 }
265 
266 #endif
267 
header file for colormap class
~class_colormap(void)
Definition: colormap.cpp:45
int init_colormap_hsv(int total, float alfa, bool reverse)
Definition: colormap.cpp:158
int init_colormap_hot(int total, float alfa, bool reverse)
Definition: colormap.cpp:166
class_colormap(std::string name, int total, float alfa, bool reverse=false)
Definition: colormap.cpp:87
int init_colormap_bone(int total, float alfa, bool reverse)
Definition: colormap.cpp:230
int init_colormap_summer(int total, float alfa, bool reverse)
Definition: colormap.cpp:194
cv::Scalar cv_color(int i)
Definition: colormap.cpp:63
int init_colormap_copper(int total, float alfa, bool reverse)
Definition: colormap.cpp:239
int setup_colormap(int total, float alfa, bool reverse, float *r, float *g, float *b)
Definition: colormap.cpp:122
int init_colormap_jet(int total, float alfa, bool reverse)
Definition: colormap.cpp:150
int init_colormap_cool(int total, float alfa, bool reverse)
Definition: colormap.cpp:177
int init_colormap_winter(int total, float alfa, bool reverse)
Definition: colormap.cpp:212
int init_colormap_spring(int total, float alfa, bool reverse)
Definition: colormap.cpp:185
std::vector< std_msgs::ColorRGBA > cm
Definition: colormap.h:58
int init_colormap_autumn(int total, float alfa, bool reverse)
Definition: colormap.cpp:203
int init_colormap_gray(int total, float alfa, bool reverse)
Definition: colormap.cpp:221
int init_colormap_lines(int total, float alfa, bool reverse)
Definition: colormap.cpp:257
int init_colormap_pink(int total, float alfa, bool reverse)
Definition: colormap.cpp:248
std_msgs::ColorRGBA color(int i)
Definition: colormap.cpp:47


colormap
Author(s): Miguel Oliveira
autogenerated on Mon Mar 2 2015 01:31:33