CARLA
Loading...
Searching...
No Matches
CarlaOpticalFlowCameraPublisher.cpp
Go to the documentation of this file.
1// Copyright (c) 2026 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
8
10
11namespace carla {
12namespace ros2 {
13
15 uint32_t height, uint32_t width, const uint8_t *data) const {
16 // The optical-flow buffer arriving from ImageSerializer holds two floats
17 // (vx, vy) per pixel. ROS2.cpp's OpticalFlowCamera dispatch passes the
18 // post-header pointer through CarlaCameraPublisher::WriteImage as
19 // const uint8_t*, so reinterpret it back to its real layout here.
20 const auto *flow = reinterpret_cast<const float *>(data);
21 return EncodeFlowImageToBgra(height, width, flow);
22}
23
24} // namespace ros2
25} // namespace carla
std::vector< uint8_t > ComputeImage(uint32_t height, uint32_t width, const uint8_t *data) const override
std::vector< uint8_t > EncodeFlowImageToBgra(uint32_t height, uint32_t width, const float *data)
This file contains definitions of common data structures used in traffic manager.