1 #ifdef USE_3D_ADAM_MODEL
2 #ifndef OPENPOSE_GUI_W_GUI_ADAM_HPP
3 #define OPENPOSE_GUI_W_GUI_ADAM_HPP
11 template<
typename TDatums>
12 class WGuiAdam :
public WorkerConsumer<TDatums>
15 explicit WGuiAdam(
const std::shared_ptr<GuiAdam>& guiAdam);
19 void initializationOnThread();
21 void workConsumer(
const TDatums& tDatums);
24 std::shared_ptr<GuiAdam> spGuiAdam;
38 template<
typename TDatums>
39 WGuiAdam<TDatums>::WGuiAdam(
const std::shared_ptr<GuiAdam>& guiAdam) :
44 template<
typename TDatums>
45 WGuiAdam<TDatums>::~WGuiAdam()
49 template<
typename TDatums>
50 void WGuiAdam<TDatums>::initializationOnThread()
54 spGuiAdam->initializationOnThread();
56 catch (
const std::exception& e)
58 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
62 template<
typename TDatums>
63 void WGuiAdam<TDatums>::workConsumer(
const TDatums& tDatums)
68 if (tDatums !=
nullptr)
71 opLogIfDebug(
"", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
73 const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__);
75 if (!tDatums->empty())
78 std::vector<Mat> cvOutputDatas;
79 for (
auto& tDatum : *tDatums)
80 cvOutputDatas.emplace_back(tDatumPtr->cvOutputData);
81 spGuiAdam->setImage(cvOutputDatas);
83 const auto& tDatumPtr = (*tDatums)[0];
84 if (!tDatumPtr->poseKeypoints3D.empty())
85 spGuiAdam->generateMesh(
86 tDatumPtr->poseKeypoints3D, tDatumPtr->faceKeypoints3D, tDatumPtr->handKeypoints3D,
87 tDatumPtr->adamPose.data(), tDatumPtr->adamTranslation.data(), tDatumPtr->vtVec.data(),
88 tDatumPtr->vtVec.rows(), tDatumPtr->j0Vec.data(), tDatumPtr->j0Vec.rows(),
89 tDatumPtr->adamFaceCoeffsExp.data());
94 if (!tDatums->empty())
96 Profiler::timerEnd(profilerKey);
97 Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__);
100 opLogIfDebug(
"", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
103 catch (
const std::exception& e)
106 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
#define COMPILE_TEMPLATE_DATUM(templateName)
#define DELETE_COPY(className)
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="")