AI Watch A1
Multi-person 3D skeleton detection using Intel RealSense and OpenPose with Kafka support.
|
OutputManagerJSON class is a class that abstracts final JSON output-producing operations. More...
#include <OutputManager.hpp>
Public Member Functions | |
bool | loadJSON (std::string filePathJSON, Json::Value ¤tJSON) |
Loads a JSON file and returns it as a reference. The JSON file path on disk is given. More... | |
void | saveJSON (std::string filePath) |
Saves content present in the "stringOutputData" in a JSON file. The file path where to save the file is given. More... | |
Json::Value | getValueAt (std::string key, Json::Value currentJSON) |
Utility method to get the value at a given key in a given JSON node. More... | |
Json::Value | getValueAt (unsigned int i, Json::Value currentJSON) |
Utility method to get i-th value in a given JSON node. More... | |
Json::Value | getValueAt (std::string key, unsigned int i, Json::Value currentJSON) |
Utility method to get the value at a given key of the i-th value in a given JSON node. More... | |
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 frame, color, depth, distance, and skeleton-only frame, the current frame ID, and the output folder's path on disk and for each person in the people's JSON node, the method extracts, generates, and appends a single Skeleton to the current JSON node. More... | |
Protected Member Functions | |
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. More... | |
void | setStringOutputData (std::string stringOutputData) |
Set the output file's content. More... | |
std::string | getStringOutputData (void) |
Get the output file's content. More... | |
Private Attributes | |
std::string | stringOutputData |
Output file's content. More... | |
OutputManagerJSON class is a class that abstracts final JSON output-producing operations.
Definition at line 73 of file OutputManager.hpp.
void OutputManagerJSON::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 frame, color, depth, distance, and skeleton-only frame, the current frame ID, and the output folder's path on disk and for each person in the people's JSON node, the method extracts, generates, and appends a single Skeleton to the current JSON node.
people | JSON node containing people's informations detected within the frame. |
colorImage | color frame. |
distanceImage | distance frame. |
skeletonOnlyImage | skeleton-only frame. |
nFrame | current image ID. |
outputFolder | output folder's path on disk. |
skeletonThreshold | The magnitude or intensity that must be exceeded for a specific reaction, phenomenon, result, or condition to occur or be manifested. In this case, if the skeleton's confidence mean value is greater than "skeletonThreshold", then the skeleton will be considered a meaningful skeleton. |
Definition at line 67 of file OutputManagerJSON.cpp.
References Skeleton::generateSkeleton(), Skeleton::getBodyKeyPointsMap(), Skeleton::getConsistency(), Skeleton::getSkeletonPoints3D(), getValueAt(), JSON_FILE_PATH, makeOutputString(), saveJSON(), and OutputManager::setStringOutputData().
Referenced by OpenCV_Manager::showSkeletonsCV().
|
protectedinherited |
Get the output file's content.
Definition at line 19 of file OutputManager.cpp.
References OutputManager::stringOutputData.
Referenced by saveJSON().
Json::Value OutputManagerJSON::getValueAt | ( | std::string | key, |
Json::Value | currentJSON | ||
) |
Utility method to get the value at a given key in a given JSON node.
key | Key at which the value in the JSON node will be found. |
currentJSON | Reference to JSON node. |
Definition at line 55 of file OutputManagerJSON.cpp.
Referenced by Skeleton::calcBodyKeypoints(), createJSON(), and OpenCV_Manager::showSkeletonsCV().
Json::Value OutputManagerJSON::getValueAt | ( | std::string | key, |
unsigned int | i, | ||
Json::Value | currentJSON | ||
) |
Utility method to get the value at a given key of the i-th value in a given JSON node.
key | Key at which the value in the JSON node will be found. |
i | Index at which the value in the JSON node will be found. |
currentJSON | Reference to JSON node. |
Definition at line 63 of file OutputManagerJSON.cpp.
Json::Value OutputManagerJSON::getValueAt | ( | unsigned int | i, |
Json::Value | currentJSON | ||
) |
Utility method to get i-th value in a given JSON node.
i | Index at which the value in the JSON node will be found. |
currentJSON | Reference to JSON node. |
Definition at line 59 of file OutputManagerJSON.cpp.
bool OutputManagerJSON::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.
filePathJSON | JSON file path on disk. |
currentJSON | JSON reference where the JSON file will be load. |
Definition at line 42 of file OutputManagerJSON.cpp.
Referenced by FacadeSingleton::sendData(), and OpenCV_Manager::showSkeletonsCV().
|
overrideprotectedvirtual |
This method is specific for saving the output in JSON format.
skeletonPoints3D | A vector that contains pointers to Points3D whose coordinates represent the skeleton's junctions in certain space coordinates. |
bodyKeyPointsMap | A vector that contains for each body joint retrieved from OpenPose a corresponding boolean that means if that body joint is a valuable and effective body joint or not. |
frameID | current frame ID. |
personID | current person ID within the current frame. |
Implements OutputManager.
Definition at line 15 of file OutputManagerJSON.cpp.
References openPoseBodyKeyPointsNumber, and OutputManager::setStringOutputData().
Referenced by createJSON().
void OutputManagerJSON::saveJSON | ( | std::string | filePath | ) |
Saves content present in the "stringOutputData" in a JSON file. The file path where to save the file is given.
filePath | The file path where to save the JSON file. |
Definition at line 48 of file OutputManagerJSON.cpp.
References OutputManager::getStringOutputData().
Referenced by createJSON().
|
protectedinherited |
Set the output file's content.
stringOutputData |
Definition at line 15 of file OutputManager.cpp.
References OutputManager::stringOutputData.
Referenced by createJSON(), and makeOutputString().
|
privateinherited |
Output file's content.
Definition at line 37 of file OutputManager.hpp.
Referenced by OutputManager::getStringOutputData(), and OutputManager::setStringOutputData().