ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
PinholeCameraParameters.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 <Logging.h>
11 #include <json/json.h>
12 
13 namespace cloudViewer {
14 namespace camera {
15 using namespace cloudViewer;
16 
19 
21  Json::Value trajectory_array;
22  value["class_name"] = "PinholeCameraParameters";
23  value["version_major"] = 1;
24  value["version_minor"] = 0;
25  if (EigenMatrix4dToJsonArray(extrinsic_, value["extrinsic"]) == false) {
26  return false;
27  }
28  if (intrinsic_.ConvertToJsonValue(value["intrinsic"]) == false) {
29  return false;
30  }
31  return true;
32 }
33 
35  if (value.isObject() == false) {
37  "PinholeCameraParameters read JSON failed: unsupported json "
38  "format.");
39  return false;
40  }
41  if (value.get("class_name", "").asString() != "PinholeCameraParameters" ||
42  value.get("version_major", 1).asInt() != 1 ||
43  value.get("version_minor", 0).asInt() != 0) {
45  "PinholeCameraParameters read JSON failed: unsupported json "
46  "format.");
47  return false;
48  }
49  if (intrinsic_.ConvertFromJsonValue(value["intrinsic"]) == false) {
50  return false;
51  }
52  if (EigenMatrix4dFromJsonArray(extrinsic_, value["extrinsic"]) == false) {
53  return false;
54  }
55  return true;
56 }
57 } // namespace camera
58 } // namespace cloudViewer
bool ConvertFromJsonValue(const Json::Value &value) override
bool ConvertToJsonValue(Json::Value &value) const override
#define LogWarning(...)
Definition: Logging.h:72
Generic file read and write utility for python interface.
static vtkPVTrivialProducerStaticInternal Value