OpenPose 1.0.0rc2 OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
wJointAngleEstimation.hpp
Go to the documentation of this file.
1 #ifdef USE_3D_ADAM_MODEL
2 #ifndef OPENPOSE_3D_W_JOINT_ANGLE_ESTIMATION_HPP
3 #define OPENPOSE_3D_W_JOINT_ANGLE_ESTIMATION_HPP
4
5 #include <openpose/core/common.hpp>
6 #include <openpose/3d/jointAngleEstimation.hpp>
7 #include <openpose/thread/worker.hpp>
8
9 namespace op
10 {
11 template<typename TDatums>
12 class WJointAngleEstimation : public Worker<TDatums>
13 {
14 public:
15 explicit WJointAngleEstimation(const std::shared_ptr<JointAngleEstimation>& jointAngleEstimation);
16
17 virtual ~WJointAngleEstimation();
18
19 void initializationOnThread();
20
21 void work(TDatums& tDatums);
22
23 private:
24 const std::shared_ptr<JointAngleEstimation> spJointAngleEstimation;
25
26 DELETE_COPY(WJointAngleEstimation);
27 };
28 }
29
30
31
32
33
34 // Implementation
35 #include <openpose/utilities/pointerContainer.hpp>
36 namespace op
37 {
38 template<typename TDatums>
39 WJointAngleEstimation<TDatums>::WJointAngleEstimation(const std::shared_ptr<JointAngleEstimation>& jointAngleEstimation) :
40 spJointAngleEstimation{jointAngleEstimation}
41 {
42 }
43
44 template<typename TDatums>
45 WJointAngleEstimation<TDatums>::~WJointAngleEstimation()
46 {
47 }
48
49 template<typename TDatums>
50 void WJointAngleEstimation<TDatums>::initializationOnThread()
51 {
52 try
53 {
54 spJointAngleEstimation->initializationOnThread();
55 }
56 catch (const std::exception& e)
57 {
58 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
59 }
60 }
61
62 template<typename TDatums>
63 void WJointAngleEstimation<TDatums>::work(TDatums& tDatums)
64 {
65 try
66 {
67 if (checkNoNullNorEmpty(tDatums))
68 {
69 // Debugging log
70 dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
71 // Profiling speed
72 const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__);
73 // Input
74 auto& datum = tDatums->at(0);
75 const auto& poseKeypoints3D = datum.poseKeypoints3D;
76 const auto& faceKeypoints3D = datum.faceKeypoints3D;
77 const auto& handKeypoints3D = datum.handKeypoints3D;
78 // Running Adam model
79 spJointAngleEstimation->adamFastFit(
80 datum.adamPose, datum.adamTranslation, datum.vtVec, datum.j0Vec,
81 datum.adamFaceCoeffsExp, poseKeypoints3D, faceKeypoints3D, handKeypoints3D);
82 // Profiling speed
83 Profiler::timerEnd(profilerKey);
84 Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__);
85 // Debugging log
86 dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
87 }
88 }
89 catch (const std::exception& e)
90 {
91 this->stop();
92 tDatums = nullptr;
93 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
94 }
95 }
96
97 COMPILE_TEMPLATE_DATUM(WJointAngleEstimation);
98 }
99
100 #endif // OPENPOSE_3D_W_JOINT_ANGLE_ESTIMATION_HPP
101 #endif
DELETE_COPY
#define DELETE_COPY(className)
Definition: macros.hpp:34
op::Priority::Low
common.hpp
op::Profiler::timerInit
static const std::string timerInit(const int line, const std::string &function, const std::string &file)
op::error
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")
pointerContainer.hpp
op::dLog
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
worker.hpp
jointAngleEstimation.hpp
op::checkNoNullNorEmpty
bool checkNoNullNorEmpty(const TPointerContainer &tPointerContainer)
Definition: pointerContainer.hpp:7
op::Profiler::printAveragedTimeMsOnIterationX
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)
op::COMPILE_TEMPLATE_DATUM
COMPILE_TEMPLATE_DATUM(WPoseTriangulation)
op::Profiler::timerEnd
static void timerEnd(const std::string &key)