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