CARLA
CityScapesPalette.h
Go to the documentation of this file.
1 // Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 #include <cstdint>
10 
11 namespace carla {
12 namespace image {
13 namespace detail {
14 
15  static constexpr
16 #if __cplusplus >= 201703L // C++17
17  inline
18 #endif
19  // Please update documentation if you change this.
20  uint8_t CITYSCAPES_PALETTE_MAP[][3u] = {
21  { 0u, 0u, 0u}, // unlabeled = 0u
22  // cityscape
23  {128u, 64u, 128u}, // road = 1u
24  {244u, 35u, 232u}, // sidewalk = 2u
25  { 70u, 70u, 70u}, // building = 3u
26  {102u, 102u, 156u}, // wall = 4u
27  {190u, 153u, 153u}, // fence = 5u
28  {153u, 153u, 153u}, // pole = 6u
29  {250u, 170u, 30u}, // traffic light = 7u
30  {220u, 220u, 0u}, // traffic sign = 8u
31  {107u, 142u, 35u}, // vegetation = 9u
32  {152u, 251u, 152u}, // terrain = 10u
33  { 70u, 130u, 180u}, // sky = 11u
34  {220u, 20u, 60u}, // pedestrian = 12u
35  {255u, 0u, 0u}, // rider = 13u
36  { 0u, 0u, 142u}, // Car = 14u
37  { 0u, 0u, 70u}, // truck = 15u
38  { 0u, 60u, 100u}, // bus = 16u
39  { 0u, 80u, 100u}, // train = 17u
40  { 0u, 0u, 230u}, // motorcycle = 18u
41  {119u, 11u, 32u}, // bicycle = 19u
42  // custom
43  {110u, 190u, 160u}, // static = 20u
44  {170u, 120u, 50u}, // dynamic = 21u
45  { 55u, 90u, 80u}, // other = 22u
46  { 45u, 60u, 150u}, // water = 23u
47  {157u, 234u, 50u}, // road line = 24u
48  { 81u, 0u, 81u}, // ground = 25u
49  {150u, 100u, 100u}, // bridge = 26u
50  {230u, 150u, 140u}, // rail track = 27u
51  {180u, 165u, 180u} // guard rail = 28u
52  };
53 
54 } // namespace detail
55 
57  public:
58 
59  static constexpr auto GetNumberOfTags() {
60  return sizeof(detail::CITYSCAPES_PALETTE_MAP) /
62  }
63 
64  /// Return an RGB uint8_t array.
65  ///
66  /// @warning It overflows if @a tag is greater than GetNumberOfTags().
67  static constexpr auto GetColor(uint8_t tag) {
68  return detail::CITYSCAPES_PALETTE_MAP[tag % GetNumberOfTags()];
69  }
70  };
71 
72 } // namespace image
73 } // namespace carla
static constexpr auto GetNumberOfTags()
static constexpr uint8_t CITYSCAPES_PALETTE_MAP[][3u]
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
static constexpr auto GetColor(uint8_t tag)
Return an RGB uint8_t array.