ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
RGBDVideoMetadata.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
9 
10 #include <json/json.h>
11 
12 #include <unordered_map>
13 
14 namespace cloudViewer {
15 namespace t {
16 namespace io {
17 
18 bool RGBDVideoMetadata::ConvertToJsonValue(Json::Value &value) const {
20 
21  value["device_name"] = device_name_;
22  value["serial_number"] = serial_number_;
23  value["color_format"] = color_format_;
24  value["depth_format"] = depth_format_;
25  value["depth_scale"] = depth_scale_;
26 
27  value["stream_length_usec"] = stream_length_usec_;
28  value["width"] = width_;
29  value["height"] = height_;
30  value["fps"] = fps_;
31 
32  return true;
33 }
34 
35 bool RGBDVideoMetadata::ConvertFromJsonValue(const Json::Value &value) {
37 
38  serial_number_ = value["serial_number"].asString();
39  device_name_ = value["device_name"].asString();
40  color_format_ = value["color_format"].asString();
41  depth_format_ = value["depth_format"].asString();
42  depth_scale_ = value["depth_scale"].asFloat();
43 
44  stream_length_usec_ = value["stream_length_usec"].asUInt64();
45  width_ = value["width"].asInt();
46  height_ = value["height"].asInt();
47  fps_ = value["fps"].asDouble();
48 
49  return true;
50 }
51 } // namespace io
52 } // namespace t
53 } // namespace cloudViewer
bool ConvertFromJsonValue(const Json::Value &value) override
bool ConvertToJsonValue(Json::Value &value) const override
std::string color_format_
Pixel format for color data.
std::string serial_number_
Capture device serial number.
bool ConvertFromJsonValue(const Json::Value &value) override
camera::PinholeCameraIntrinsic intrinsics_
Shared intrinsics between RGB & depth.
std::string depth_format_
Pixel format for depth data.
bool ConvertToJsonValue(Json::Value &value) const override
std::string device_name_
Capture device name.
int width_
Width of the video frame.
int height_
Height of the video frame.
uint64_t stream_length_usec_
Length of the video (usec). 0 for live capture.
Generic file read and write utility for python interface.