AI Watch A1
Multi-person 3D skeleton detection using Intel RealSense and OpenPose with Kafka support.
OutputManager.hpp
Go to the documentation of this file.
1//
2// OutputManager.hpp
3// AI Watch A1
4//
5// Created by Denny Caruso on 23/07/22.
6//
7
8// License: Apache 2.0. See LICENSE file in root directory.
9// Copyright(c) 2022. All Rights Reserved.
10
11#ifndef OutputManager_hpp
12#define OutputManager_hpp
13
14#include <iostream>
15#include <sstream>
16#include <fstream>
17#include <string>
18#include <vector>
19#include <json/json.h>
20#include <json/value.h>
21#include <opencv2/core.hpp>
22#include "../../Points/Point3D.hpp"
23#include "../../Points/BodyKeyPoint.hpp"
24#include "../../Skeleton.hpp"
25
26
27
33private:
37 std::string stringOutputData;
38protected:
43 void setStringOutputData (std::string stringOutputData);
48 std::string getStringOutputData (void);
59 virtual Json::Value makeOutputString (std::vector <Point3D *> skeletonPoints3D, std::vector <bool> bodyKeyPointsMap,
60 unsigned int frameID, unsigned int personID) = 0;
61public:
65 virtual ~OutputManager() = default;
66};
67
68
69
74protected:
84 Json::Value makeOutputString (std::vector <Point3D *> skeletonPoints3D, std::vector <bool> bodyKeyPointsMap,
85 unsigned int frameID, unsigned int personID) override;
86public:
94 bool loadJSON (std::string filePathJSON, Json::Value & currentJSON);
99 void saveJSON (std::string filePath);
100
101
102
109 Json::Value getValueAt (std::string key, Json::Value currentJSON);
116 Json::Value getValueAt (unsigned int i, Json::Value currentJSON);
124 Json::Value getValueAt (std::string key, unsigned int i, Json::Value currentJSON);
139 void createJSON (Json::Value & people, cv::Mat & colorImage, cv::Mat & distanceImage, cv::Mat & skeletonOnlyImage,
140 unsigned int nFrame, const char * outputFolder, const float skeletonThreshold);
141};
142
143#endif /* OutputManager_hpp */
OutputManagerJSON class is a class that abstracts final JSON output-producing operations.
void createJSON(Json::Value &people, cv::Mat &colorImage, cv::Mat &distanceImage, cv::Mat &skeletonOnlyImage, unsigned int nFrame, const char *outputFolder, const float skeletonThreshold)
This methods take a reference to a JSON node that represents all the people's informations within the...
Json::Value makeOutputString(std::vector< Point3D * > skeletonPoints3D, std::vector< bool > bodyKeyPointsMap, unsigned int frameID, unsigned int personID) override
This method is specific for saving the output in JSON format.
void saveJSON(std::string filePath)
Saves content present in the "stringOutputData" in a JSON file. The file path where to save the file ...
Json::Value getValueAt(std::string key, Json::Value currentJSON)
Utility method to get the value at a given key in a given JSON node.
bool loadJSON(std::string filePathJSON, Json::Value &currentJSON)
Loads a JSON file and returns it as a reference. The JSON file path on disk is given.
OutputManager class is a class that abstracts final output-producing operations. An output format inh...
void setStringOutputData(std::string stringOutputData)
Set the output file's content.
virtual ~OutputManager()=default
Destroy the Output Manager object.
std::string getStringOutputData(void)
Get the output file's content.
virtual Json::Value makeOutputString(std::vector< Point3D * > skeletonPoints3D, std::vector< bool > bodyKeyPointsMap, unsigned int frameID, unsigned int personID)=0
This method has to be overridden from OutputManager's subclasses to fill the "stringOutputData" strin...
std::string stringOutputData
Output file's content.