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"
14 
15 namespace carla {
16 namespace sensor {
17 namespace data {
18 
19  /// Templated image for any type of pixel.
20  template <typename PixelT>
21  class ImageTmpl : public Array<PixelT> {
23  protected:
24 
28 
29  friend Serializer;
32 
33  explicit ImageTmpl(RawData &&data)
34  : Super(Serializer::header_offset, std::move(data)) {
36  }
37 
38  private:
39 
40  const auto &GetHeader() const {
42  }
43 
44  public:
45 
46  using pixel_type = PixelT;
47 
48  /// Get image width in pixels.
49  auto GetWidth() const {
50  return GetHeader().width;
51  }
52 
53  /// Get image height in pixels.
54  auto GetHeight() const {
55  return GetHeader().height;
56  }
57 
58  /// Get horizontal field of view of the image in degrees.
59  auto GetFOVAngle() const {
60  return GetHeader().fov_angle;
61  }
62  };
63 
64 } // namespace data
65 } // namespace sensor
66 } // namespace carla
const RawData & GetRawData() const
Definition: Array.h:139
Templated image for any type of pixel.
Definition: ImageTmpl.h:21
auto GetFOVAngle() const
Get horizontal field of view of the image in degrees.
Definition: ImageTmpl.h:59
auto GetHeight() const
Get image height in pixels.
Definition: ImageTmpl.h:54
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
#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
Serializes image buffers generated by camera sensors.
Serializes image buffers generated by camera sensors.
const auto & GetHeader() const
Definition: ImageTmpl.h:40
ImageTmpl(RawData &&data)
Definition: ImageTmpl.h:33
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:49