#ifndef OPENPOSE_TRACKING_W_PERSON_ID_EXTRACTOR_HPP #define OPENPOSE_TRACKING_W_PERSON_ID_EXTRACTOR_HPP #include #include #include namespace op { template class WPersonIdExtractor : public Worker { public: explicit WPersonIdExtractor(const std::shared_ptr& personIdExtractor); virtual ~WPersonIdExtractor(); void initializationOnThread(); void work(TDatums& tDatums); private: std::shared_ptr spPersonIdExtractor; DELETE_COPY(WPersonIdExtractor); }; } // Implementation #include namespace op { template WPersonIdExtractor::WPersonIdExtractor(const std::shared_ptr& personIdExtractor) : spPersonIdExtractor{personIdExtractor} { } template WPersonIdExtractor::~WPersonIdExtractor() { } template void WPersonIdExtractor::initializationOnThread() { } template void WPersonIdExtractor::work(TDatums& tDatums) { try { if (checkNoNullNorEmpty(tDatums)) { // Debugging log opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Render people pose for (auto& tDatumPtr : *tDatums) tDatumPtr->poseIds = spPersonIdExtractor->extractIds( tDatumPtr->poseKeypoints, tDatumPtr->cvInputData); // Profiling speed Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) { this->stop(); tDatums = nullptr; error(e.what(), __LINE__, __FUNCTION__, __FILE__); } } COMPILE_TEMPLATE_DATUM(WPersonIdExtractor); } #endif // OPENPOSE_TRACKING_W_PERSON_ID_EXTRACTOR_HPP