#ifndef OPENPOSE__POSE__W_POSE_RENDERER_HPP #define OPENPOSE__POSE__W_POSE_RENDERER_HPP #include // std::shared_ptr #include "../thread/worker.hpp" #include "poseRenderer.hpp" namespace op { template class WPoseRenderer : public Worker { public: explicit WPoseRenderer(const std::shared_ptr& poseRendererSharedPtr); void initializationOnThread(); void work(TDatums& tDatums); private: std::shared_ptr spPoseRenderer; DELETE_COPY(WPoseRenderer); }; } // Implementation #include "../utilities/errorAndLog.hpp" #include "../utilities/macros.hpp" #include "../utilities/pointerContainer.hpp" #include "../utilities/profiler.hpp" namespace op { template WPoseRenderer::WPoseRenderer(const std::shared_ptr& poseRendererSharedPtr) : spPoseRenderer{poseRendererSharedPtr} { } template void WPoseRenderer::initializationOnThread() { spPoseRenderer->initializationOnThread(); } template void WPoseRenderer::work(TDatums& tDatums) { try { if (checkNoNullNorEmpty(tDatums)) { // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Render people pose for (auto& tDatum : *tDatums) tDatum.elementRendered = spPoseRenderer->renderPose(tDatum.outputData, tDatum.poseKeyPoints, tDatum.scaleNetToOutput); // Profiling speed Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, Profiler::DEFAULT_X); // Debugging log dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) { this->stop(); tDatums = nullptr; error(e.what(), __LINE__, __FUNCTION__, __FILE__); } } COMPILE_TEMPLATE_DATUM(WPoseRenderer); } #endif // OPENPOSE__POSE__W_POSE_RENDERER_HPP