7 #ifndef IFM3D_DESERIALIZE_STRUCT_RGB_INFO_V1_HPP
8 #define IFM3D_DESERIALIZE_STRUCT_RGB_INFO_V1_HPP
12 #include <ifm3d/device/device.h>
13 #include <ifm3d/device/err.h>
14 #include <ifm3d/fg/organizer_utils.h>
15 #include <ifm3d/fg/buffer.h>
16 #include <ifm3d/deserialize/deserialize_utils.hpp>
17 #include <ifm3d/deserialize/struct_calibration.hpp>
23 constexpr
auto RGB_INFO_VERSION_INDEX = 0x0000;
24 constexpr
auto RGB_INFO_FRAME_COUNTER_INDEX = 0x0004;
25 constexpr
auto RGB_INFO_TIMESTAMPS_INDEX = 0x0008;
26 constexpr
auto RGB_INFO_EXPOSURE_TIMES_INDEX = 0x0010;
27 constexpr
auto RGB_INFO_EXTRINSIC_OPTICAL_TO_USER_INDEX = 0x0014;
28 constexpr
auto RGB_INFO_INTRINSIC_CALIBRATION_INDEX = 0x002C;
29 constexpr
auto RGB_INFO_INVERSE_INTRINSIC_CALIBRATION_INDEX = 0x00B0;
37 using Ptr = std::shared_ptr<RGBInfoV1>;
40 Read(
const uint8_t* data,
size_t size)
42 if (size < rgb_info_v1_size)
46 const uint8_t* start_ptr = data;
47 version = mkval<std::uint32_t>(start_ptr + RGB_INFO_VERSION_INDEX);
49 mkval<std::uint32_t>(start_ptr + RGB_INFO_FRAME_COUNTER_INDEX);
51 mkval<std::uint64_t>(start_ptr + RGB_INFO_TIMESTAMPS_INDEX);
52 exposure_time = mkval<float>(start_ptr + RGB_INFO_EXPOSURE_TIMES_INDEX);
53 extrinsic_optic_to_user.Read(start_ptr +
54 RGB_INFO_EXTRINSIC_OPTICAL_TO_USER_INDEX);
55 intrinsic_calibration.Read(start_ptr +
56 RGB_INFO_INTRINSIC_CALIBRATION_INDEX);
57 inverse_intrinsic_calibration.Read(
58 start_ptr + RGB_INFO_INVERSE_INTRINSIC_CALIBRATION_INDEX);
61 std::uint32_t version;
64 std::uint32_t frame_counter;
66 std::uint64_t timestamp_ns;
76 const size_t rgb_info_v1_size = 308;
79 Deserialize(
const Buffer& rgb_info_buffer)
83 rgb_info_v1.Read(rgb_info_buffer.
ptr<uint8_t>(0),
84 rgb_info_buffer.
size());
90 #endif // IFM3D_DESERIALIZE_STRUCT_RGB_INFO_V1_HPP