CARLA
ImageTmpl.h
Go to the documentation of this file.
1 // Copyright (c) 2019 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 "carla/Debug.h"
16 #include "carla/ros2/ROS2.h"
17 
18 namespace carla {
19 namespace sensor {
20 namespace data {
21 
22  /// Templated image for any type of pixel.
23  template <typename PixelT>
24  class ImageTmpl : public Array<PixelT> {
26  friend class carla::ros2::ROS2;
27  protected:
28 
32 
33  friend Serializer;
38 
39  explicit ImageTmpl(RawData &&data)
40  : Super(Serializer::header_offset, std::move(data)) {
42  }
43 
44  private:
45 
46  const auto &GetHeader() const {
48  }
49 
50  public:
51 
52  using pixel_type = PixelT;
53 
54  /// Get image width in pixels.
55  auto GetWidth() const {
56  return GetHeader().width;
57  }
58 
59  /// Get image height in pixels.
60  auto GetHeight() const {
61  return GetHeader().height;
62  }
63 
64  /// Get horizontal field of view of the image in degrees.
65  auto GetFOVAngle() const {
66  return GetHeader().fov_angle;
67  }
68  };
69 
70 } // namespace data
71 } // namespace sensor
72 } // namespace carla
const RawData & GetRawData() const
Definition: Array.h:139
Templated image for any type of pixel.
Definition: ImageTmpl.h:24
auto GetFOVAngle() const
Get horizontal field of view of the image in degrees.
Definition: ImageTmpl.h:65
auto GetHeight() const
Get image height in pixels.
Definition: ImageTmpl.h:60
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
#define DEBUG_ASSERT(predicate)
Definition: Debug.h:66
Serializes image buffers generated by camera sensors.
static const ImageHeader & DeserializeHeader(const RawData &data)
Base class for all the sensor data consisting of an array of items.
Definition: Array.h:23
Serializes image buffers generated by camera sensors.
Serializes image buffers generated by camera sensors.
const auto & GetHeader() const
Definition: ImageTmpl.h:46
ImageTmpl(RawData &&data)
Definition: ImageTmpl.h:39
Serializes image buffers generated by camera sensors.
Serializes image buffers generated by camera sensors.
Wrapper around the raw data generated by a sensor plus some useful meta-information.
Definition: RawData.h:21
auto GetWidth() const
Get image width in pixels.
Definition: ImageTmpl.h:55