1 #ifndef OPENPOSE_3D_W_POSE_TRIANGULATION_HPP
2 #define OPENPOSE_3D_W_POSE_TRIANGULATION_HPP
10 template<
typename TDatums>
14 explicit WPoseTriangulation(
const std::shared_ptr<PoseTriangulation>& poseTriangulation);
18 void work(TDatums& tDatums);
21 const std::shared_ptr<PoseTriangulation> spPoseTriangulation;
35 template<
typename TDatums>
37 spPoseTriangulation{poseTriangulation}
41 template<
typename TDatums>
46 spPoseTriangulation->initializationOnThread();
48 catch (
const std::exception& e)
50 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
54 template<
typename TDatums>
66 std::vector<cv::Mat> cameraMatrices;
67 std::vector<Array<float>> poseKeypointVector;
68 std::vector<Array<float>> faceKeypointVector;
69 std::vector<Array<float>> leftHandKeypointVector;
70 std::vector<Array<float>> rightHandKeypointVector;
71 std::vector<Point<int>> imageSizes;
72 for (
auto& datumsElement : *tDatums)
74 poseKeypointVector.emplace_back(datumsElement.poseKeypoints);
75 faceKeypointVector.emplace_back(datumsElement.faceKeypoints);
76 leftHandKeypointVector.emplace_back(datumsElement.handKeypoints[0]);
77 rightHandKeypointVector.emplace_back(datumsElement.handKeypoints[1]);
78 cameraMatrices.emplace_back(datumsElement.cameraMatrix);
79 imageSizes.emplace_back(
Point<int>{datumsElement.cvInputData.cols,
80 datumsElement.cvInputData.rows});
83 auto poseKeypoints3Ds = spPoseTriangulation->reconstructArray(
84 {poseKeypointVector, faceKeypointVector, leftHandKeypointVector, rightHandKeypointVector},
85 cameraMatrices, imageSizes);
87 for (
auto& datumsElement : *tDatums)
89 datumsElement.poseKeypoints3D = poseKeypoints3Ds[0];
90 datumsElement.faceKeypoints3D = poseKeypoints3Ds[1];
91 datumsElement.handKeypoints3D[0] = poseKeypoints3Ds[2];
92 datumsElement.handKeypoints3D[1] = poseKeypoints3Ds[3];
101 catch (
const std::exception& e)
105 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
112 #endif // OPENPOSE_3D_W_POSE_TRIANGULATION_HPP
static const std::string timerInit(const int line, const std::string &function, const std::string &file)
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")
WPoseTriangulation(const std::shared_ptr< PoseTriangulation > &poseTriangulation)
Definition: wPoseTriangulation.hpp:36
void dLog(const T &message, const Priority priority=Priority::Max, const int line=-1, const std::string &function="", const std::string &file="")
Definition: errorAndLog.hpp:53
bool checkNoNullNorEmpty(const TPointerContainer &tPointerContainer)
Definition: pointerContainer.hpp:7
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)
Definition: wPoseTriangulation.hpp:11
void work(TDatums &tDatums)
Definition: wPoseTriangulation.hpp:55
void initializationOnThread()
Definition: wPoseTriangulation.hpp:42
COMPILE_TEMPLATE_DATUM(WPoseTriangulation)
static void timerEnd(const std::string &key)