1 #ifndef OPENPOSE_FILESTREAM_W_PEOPLE_JSON_SAVER_HPP
2 #define OPENPOSE_FILESTREAM_W_PEOPLE_JSON_SAVER_HPP
10 template<
typename TDatums>
14 explicit WPeopleJsonSaver(
const std::shared_ptr<PeopleJsonSaver>& peopleJsonSaver);
23 const std::shared_ptr<PeopleJsonSaver> spPeopleJsonSaver;
37 template<
typename TDatums>
39 spPeopleJsonSaver{peopleJsonSaver}
43 template<
typename TDatums>
48 template<
typename TDatums>
53 template<
typename TDatums>
65 const auto& tDatumFirstPtr = (*tDatums)[0];
66 const auto baseFileName = (!tDatumFirstPtr->name.empty() ? tDatumFirstPtr->name
67 : std::to_string(tDatumFirstPtr->id)) +
"_keypoints";
68 const bool humanReadable =
false;
69 for (
auto i = 0u ; i < tDatums->size() ; i++)
71 const auto& tDatumPtr = (*tDatums)[i];
73 const auto fileName = baseFileName + (i != 0 ?
"_" + std::to_string(i) :
"");
78 const std::vector<std::pair<Array<float>, std::string>> keypointVector{
80 std::make_pair(poseIds,
"person_id"),
82 std::make_pair(tDatumPtr->poseKeypoints,
"pose_keypoints_2d"),
83 std::make_pair(tDatumPtr->faceKeypoints,
"face_keypoints_2d"),
84 std::make_pair(tDatumPtr->handKeypoints[0],
"hand_left_keypoints_2d"),
85 std::make_pair(tDatumPtr->handKeypoints[1],
"hand_right_keypoints_2d"),
87 std::make_pair(tDatumPtr->poseKeypoints3D,
"pose_keypoints_3d"),
88 std::make_pair(tDatumPtr->faceKeypoints3D,
"face_keypoints_3d"),
89 std::make_pair(tDatumPtr->handKeypoints3D[0],
"hand_left_keypoints_3d"),
90 std::make_pair(tDatumPtr->handKeypoints3D[1],
"hand_right_keypoints_3d")
93 spPeopleJsonSaver->save(
94 keypointVector, tDatumPtr->poseCandidates, fileName, humanReadable);
103 catch (
const std::exception& e)
106 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
static void printAveragedTimeMsOnIterationX(const std::string &key, const int line, const std::string &function, const std::string &file, const unsigned long long x=DEFAULT_X)
static const std::string timerInit(const int line, const std::string &function, const std::string &file)
static void timerEnd(const std::string &key)
virtual ~WPeopleJsonSaver()
void initializationOnThread()
WPeopleJsonSaver(const std::shared_ptr< PeopleJsonSaver > &peopleJsonSaver)
void workConsumer(const TDatums &tDatums)
bool checkNoNullNorEmpty(const TPointerContainer &tPointerContainer)
COMPILE_TEMPLATE_DATUM(WPoseTriangulation)
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")
void opLogIfDebug(const T &message, const Priority priority=Priority::Max, const int line=-1, const std::string &function="", const std::string &file="")