25 #ifndef INCLUDED_LoadCalibration_h_GUID_50FCDBB2_367E_4589_A034_FCFDF13C8714 26 #define INCLUDED_LoadCalibration_h_GUID_50FCDBB2_367E_4589_A034_FCFDF13C8714 32 #include <json/reader.h> 33 #include <json/value.h> 34 #include <opencv2/core/core.hpp> 46 inline cv::Point3f parsePoint(Json::Value
const &jsonArray) {
47 return cv::Point3f(jsonArray[0].asFloat(), jsonArray[1].asFloat(),
48 jsonArray[2].asFloat());
51 inline std::vector<cv::Point3f>
54 std::vector<cv::Point3f> ret;
55 if (!jsonArray.isArray()) {
58 for (
auto &entry : jsonArray) {
60 if (!entry.isArray() || entry.size() != 3) {
64 ret.emplace_back(parsePoint(entry));
69 inline std::vector<cv::Point3f>
70 tryLoadingArrayOfPointsFromFile(std::string
const &filename) {
71 std::vector<cv::Point3f> ret;
72 if (filename.empty()) {
77 std::ifstream calibfile(filename);
78 if (!calibfile.good()) {
82 if (!reader.parse(calibfile, root)) {
93 static const double BEACON_AUTOCALIB_ERROR_SCALE_IF_CALIBRATED = 0.1;
96 inline void loadedCalibFileSuccessfully(std::string
const &filename) {
97 std::cout <<
"Video-based tracker: Successfully loaded " 98 "beacon calibration file " 99 << filename << std::endl;
103 calibFileSpecifiedButNotLoaded(std::string
const &filename) {
104 std::cout <<
"Video-based tracker: NOTE: Beacon calibration " 107 <<
" was specified, but not found or could not " 108 "be loaded. This is not an error: This may just mean " 109 "you have not run the optional beacon " 110 "pre-calibration step." 118 #endif // INCLUDED_LoadCalibration_h_GUID_50FCDBB2_367E_4589_A034_FCFDF13C8714 std::vector< cv::Point3f > parseArrayOfPoints(Json::Value const &jsonArray)
Definition: LoadCalibration.h:52
Definition: CommonComponent.h:44
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3