rgb_colors.cpp
Go to the documentation of this file.
1 // -*- mode: c++ -*-
2 /*********************************************************************
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2015, JSK Lab
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/o2r other materials provided
17  * with the distribution.
18  * * Neither the name of the JSK Lab nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
37 #include <opencv2/core/core.hpp>
38 
39 
40 namespace jsk_recognition_utils
41 {
42 
43  cv::Vec3d getRGBColor(const int color)
44  {
45  cv::Vec3d c;
46  switch (color % 146) {
47  case ALICEBLUE: c = cv::Vec3d(0.941, 0.973, 1); break;
48  case ANTIQUEWHITE: c = cv::Vec3d(0.98, 0.922, 0.843); break;
49  case AQUA: c = cv::Vec3d(0, 1, 1); break;
50  case AQUAMARINE: c = cv::Vec3d(0.498, 1, 0.831); break;
51  case AZURE: c = cv::Vec3d(0.941, 1, 1); break;
52  case BEIGE: c = cv::Vec3d(0.961, 0.961, 0.863); break;
53  case BISQUE: c = cv::Vec3d(1, 0.894, 0.769); break;
54  case BLACK: c = cv::Vec3d(0, 0, 0); break;
55  case BLANCHEDALMOND: c = cv::Vec3d(1, 0.922, 0.804); break;
56  case BLUE: c = cv::Vec3d(0, 0, 1); break;
57  case BLUEVIOLET: c = cv::Vec3d(0.541, 0.169, 0.886); break;
58  case BROWN: c = cv::Vec3d(0.647, 0.165, 0.165); break;
59  case BURLYWOOD: c = cv::Vec3d(0.871, 0.722, 0.529); break;
60  case CADETBLUE: c = cv::Vec3d(0.373, 0.62, 0.627); break;
61  case CHARTREUSE: c = cv::Vec3d(0.498, 1, 0); break;
62  case CHOCOLATE: c = cv::Vec3d(0.824, 0.412, 0.118); break;
63  case CORAL: c = cv::Vec3d(1, 0.498, 0.314); break;
64  case CORNFLOWERBLUE: c = cv::Vec3d(0.392, 0.584, 0.929); break;
65  case CORNSILK: c = cv::Vec3d(1, 0.973, 0.863); break;
66  case CRIMSON: c = cv::Vec3d(0.863, 0.0784, 0.235); break;
67  case CYAN: c = cv::Vec3d(0, 1, 1); break;
68  case DARKBLUE: c = cv::Vec3d(0, 0, 0.545); break;
69  case DARKCYAN: c = cv::Vec3d(0, 0.545, 0.545); break;
70  case DARKGOLDENROD: c = cv::Vec3d(0.722, 0.525, 0.0431); break;
71  case DARKGRAY: c = cv::Vec3d(0.663, 0.663, 0.663); break;
72  case DARKGREEN: c = cv::Vec3d(0, 0.392, 0); break;
73  case DARKGREY: c = cv::Vec3d(0.663, 0.663, 0.663); break;
74  case DARKKHAKI: c = cv::Vec3d(0.741, 0.718, 0.42); break;
75  case DARKMAGENTA: c = cv::Vec3d(0.545, 0, 0.545); break;
76  case DARKOLIVEGREEN: c = cv::Vec3d(0.333, 0.42, 0.184); break;
77  case DARKORANGE: c = cv::Vec3d(1, 0.549, 0); break;
78  case DARKORCHID: c = cv::Vec3d(0.6, 0.196, 0.8); break;
79  case DARKRED: c = cv::Vec3d(0.545, 0, 0); break;
80  case DARKSALMON: c = cv::Vec3d(0.914, 0.588, 0.478); break;
81  case DARKSEAGREEN: c = cv::Vec3d(0.561, 0.737, 0.561); break;
82  case DARKSLATEBLUE: c = cv::Vec3d(0.282, 0.239, 0.545); break;
83  case DARKSLATEGRAY: c = cv::Vec3d(0.184, 0.31, 0.31); break;
84  case DARKSLATEGREY: c = cv::Vec3d(0.184, 0.31, 0.31); break;
85  case DARKTURQUOISE: c = cv::Vec3d(0, 0.808, 0.82); break;
86  case DARKVIOLET: c = cv::Vec3d(0.58, 0, 0.827); break;
87  case DEEPPINK: c = cv::Vec3d(1, 0.0784, 0.576); break;
88  case DEEPSKYBLUE: c = cv::Vec3d(0, 0.749, 1); break;
89  case DIMGRAY: c = cv::Vec3d(0.412, 0.412, 0.412); break;
90  case DIMGREY: c = cv::Vec3d(0.412, 0.412, 0.412); break;
91  case DODGERBLUE: c = cv::Vec3d(0.118, 0.565, 1); break;
92  case FIREBRICK: c = cv::Vec3d(0.698, 0.133, 0.133); break;
93  case FLORALWHITE: c = cv::Vec3d(1, 0.98, 0.941); break;
94  case FORESTGREEN: c = cv::Vec3d(0.133, 0.545, 0.133); break;
95  case FUCHSIA: c = cv::Vec3d(1, 0, 1); break;
96  case GAINSBORO: c = cv::Vec3d(0.863, 0.863, 0.863); break;
97  case GHOSTWHITE: c = cv::Vec3d(0.973, 0.973, 1); break;
98  case GOLD: c = cv::Vec3d(1, 0.843, 0); break;
99  case GOLDENROD: c = cv::Vec3d(0.855, 0.647, 0.125); break;
100  case GRAY: c = cv::Vec3d(0.502, 0.502, 0.502); break;
101  case GREEN: c = cv::Vec3d(0, 0.502, 0); break;
102  case GREENYELLOW: c = cv::Vec3d(0.678, 1, 0.184); break;
103  case GREY: c = cv::Vec3d(0.502, 0.502, 0.502); break;
104  case HONEYDEW: c = cv::Vec3d(0.941, 1, 0.941); break;
105  case HOTPINK: c = cv::Vec3d(1, 0.412, 0.706); break;
106  case INDIANRED: c = cv::Vec3d(0.804, 0.361, 0.361); break;
107  case INDIGO: c = cv::Vec3d(0.294, 0, 0.51); break;
108  case IVORY: c = cv::Vec3d(1, 1, 0.941); break;
109  case KHAKI: c = cv::Vec3d(0.941, 0.902, 0.549); break;
110  case LAVENDER: c = cv::Vec3d(0.902, 0.902, 0.98); break;
111  case LAVENDERBLUSH: c = cv::Vec3d(1, 0.941, 0.961); break;
112  case LAWNGREEN: c = cv::Vec3d(0.486, 0.988, 0); break;
113  case LEMONCHIFFON: c = cv::Vec3d(1, 0.98, 0.804); break;
114  case LIGHTBLUE: c = cv::Vec3d(0.678, 0.847, 0.902); break;
115  case LIGHTCORAL: c = cv::Vec3d(0.941, 0.502, 0.502); break;
116  case LIGHTCYAN: c = cv::Vec3d(0.878, 1, 1); break;
117  case LIGHTGOLDENRODYELLOW: c = cv::Vec3d(0.98, 0.98, 0.824); break;
118  case LIGHTGRAY: c = cv::Vec3d(0.827, 0.827, 0.827); break;
119  case LIGHTGREEN: c = cv::Vec3d(0.565, 0.933, 0.565); break;
120  case LIGHTGREY: c = cv::Vec3d(0.827, 0.827, 0.827); break;
121  case LIGHTPINK: c = cv::Vec3d(1, 0.714, 0.757); break;
122  case LIGHTSALMON: c = cv::Vec3d(1, 0.627, 0.478); break;
123  case LIGHTSEAGREEN: c = cv::Vec3d(0.125, 0.698, 0.667); break;
124  case LIGHTSKYBLUE: c = cv::Vec3d(0.529, 0.808, 0.98); break;
125  case LIGHTSLATEGRAY: c = cv::Vec3d(0.467, 0.533, 0.6); break;
126  case LIGHTSLATEGREY: c = cv::Vec3d(0.467, 0.533, 0.6); break;
127  case LIGHTSTEELBLUE: c = cv::Vec3d(0.69, 0.769, 0.871); break;
128  case LIGHTYELLOW: c = cv::Vec3d(1, 1, 0.878); break;
129  case LIME: c = cv::Vec3d(0, 1, 0); break;
130  case LIMEGREEN: c = cv::Vec3d(0.196, 0.804, 0.196); break;
131  case LINEN: c = cv::Vec3d(0.98, 0.941, 0.902); break;
132  case MAGENTA: c = cv::Vec3d(1, 0, 1); break;
133  case MAROON: c = cv::Vec3d(0.502, 0, 0); break;
134  case MEDIUMAQUAMARINE: c = cv::Vec3d(0.4, 0.804, 0.667); break;
135  case MEDIUMBLUE: c = cv::Vec3d(0, 0, 0.804); break;
136  case MEDIUMORCHID: c = cv::Vec3d(0.729, 0.333, 0.827); break;
137  case MEDIUMPURPLE: c = cv::Vec3d(0.576, 0.439, 0.859); break;
138  case MEDIUMSEAGREEN: c = cv::Vec3d(0.235, 0.702, 0.443); break;
139  case MEDIUMSLATEBLUE: c = cv::Vec3d(0.482, 0.408, 0.933); break;
140  case MEDIUMSPRINGGREEN: c = cv::Vec3d(0, 0.98, 0.604); break;
141  case MEDIUMTURQUOISE: c = cv::Vec3d(0.282, 0.82, 0.8); break;
142  case MEDIUMVIOLETRED: c = cv::Vec3d(0.78, 0.0824, 0.522); break;
143  case MIDNIGHTBLUE: c = cv::Vec3d(0.098, 0.098, 0.439); break;
144  case MINTCREAM: c = cv::Vec3d(0.961, 1, 0.98); break;
145  case MISTYROSE: c = cv::Vec3d(1, 0.894, 0.882); break;
146  case MOCCASIN: c = cv::Vec3d(1, 0.894, 0.71); break;
147  case NAVAJOWHITE: c = cv::Vec3d(1, 0.871, 0.678); break;
148  case NAVY: c = cv::Vec3d(0, 0, 0.502); break;
149  case OLDLACE: c = cv::Vec3d(0.992, 0.961, 0.902); break;
150  case OLIVE: c = cv::Vec3d(0.502, 0.502, 0); break;
151  case OLIVEDRAB: c = cv::Vec3d(0.42, 0.557, 0.137); break;
152  case ORANGE: c = cv::Vec3d(1, 0.647, 0); break;
153  case ORANGERED: c = cv::Vec3d(1, 0.271, 0); break;
154  case ORCHID: c = cv::Vec3d(0.855, 0.439, 0.839); break;
155  case PALEGOLDENROD: c = cv::Vec3d(0.933, 0.91, 0.667); break;
156  case PALEGREEN: c = cv::Vec3d(0.596, 0.984, 0.596); break;
157  case PALEVIOLETRED: c = cv::Vec3d(0.686, 0.933, 0.933); break;
158  case PAPAYAWHIP: c = cv::Vec3d(1, 0.937, 0.835); break;
159  case PEACHPUFF: c = cv::Vec3d(1, 0.855, 0.725); break;
160  case PERU: c = cv::Vec3d(0.804, 0.522, 0.247); break;
161  case PINK: c = cv::Vec3d(1, 0.753, 0.796); break;
162  case PLUM: c = cv::Vec3d(0.867, 0.627, 0.867); break;
163  case POWDERBLUE: c = cv::Vec3d(0.69, 0.878, 0.902); break;
164  case PURPLE: c = cv::Vec3d(0.502, 0, 0.502); break;
165  case RED: c = cv::Vec3d(1, 0, 0); break;
166  case ROSYBROWN: c = cv::Vec3d(0.737, 0.561, 0.561); break;
167  case ROYALBLUE: c = cv::Vec3d(0.255, 0.412, 0.882); break;
168  case SADDLEBROWN: c = cv::Vec3d(0.545, 0.271, 0.0745); break;
169  case SALMON: c = cv::Vec3d(0.98, 0.502, 0.447); break;
170  case SANDYBROWN: c = cv::Vec3d(0.98, 0.643, 0.376); break;
171  case SEAGREEN: c = cv::Vec3d(0.18, 0.545, 0.341); break;
172  case SEASHELL: c = cv::Vec3d(1, 0.961, 0.933); break;
173  case SIENNA: c = cv::Vec3d(0.627, 0.322, 0.176); break;
174  case SILVER: c = cv::Vec3d(0.753, 0.753, 0.753); break;
175  case SKYBLUE: c = cv::Vec3d(0.529, 0.808, 0.922); break;
176  case SLATEBLUE: c = cv::Vec3d(0.416, 0.353, 0.804); break;
177  case SLATEGRAY: c = cv::Vec3d(0.439, 0.502, 0.565); break;
178  case SLATEGREY: c = cv::Vec3d(0.439, 0.502, 0.565); break;
179  case SNOW: c = cv::Vec3d(1, 0.98, 0.98); break;
180  case SPRINGGREEN: c = cv::Vec3d(0, 1, 0.498); break;
181  case STEELBLUE: c = cv::Vec3d(0.275, 0.51, 0.706); break;
182  case TAN: c = cv::Vec3d(0.824, 0.706, 0.549); break;
183  case TEAL: c = cv::Vec3d(0, 0.502, 0.502); break;
184  case THISTLE: c = cv::Vec3d(0.847, 0.749, 0.847); break;
185  case TOMATO: c = cv::Vec3d(1, 0.388, 0.278); break;
186  case TURQUOISE: c = cv::Vec3d(0.251, 0.878, 0.816); break;
187  case VIOLET: c = cv::Vec3d(0.933, 0.51, 0.933); break;
188  case WHEAT: c = cv::Vec3d(0.961, 0.871, 0.702); break;
189  case WHITE: c = cv::Vec3d(1, 1, 1); break;
190  case WHITESMOKE: c = cv::Vec3d(0.961, 0.961, 0.961); break;
191  case YELLOW: c = cv::Vec3d(1, 1, 0); break;
192  case YELLOWGREEN: c = cv::Vec3d(0.604, 0.804, 0.196); break;
193  } // switch
194  return c;
195  }
196 
197 }
cv::Vec3d getRGBColor(const int color)
get rgb color with enum.
Definition: rgb_colors.cpp:43


jsk_recognition_utils
Author(s):
autogenerated on Mon May 3 2021 03:03:03