#ifndef OPENPOSE_CORE_W_OP_OUTPUT_TO_CV_MAT_HPP #define OPENPOSE_CORE_W_OP_OUTPUT_TO_CV_MAT_HPP #include #include #include namespace op { template class WOpOutputToCvMat : public Worker { public: explicit WOpOutputToCvMat(const std::shared_ptr& opOutputToCvMat); virtual ~WOpOutputToCvMat(); void initializationOnThread(); void work(TDatums& tDatums); private: const std::shared_ptr spOpOutputToCvMat; DELETE_COPY(WOpOutputToCvMat); }; } // Implementation #include namespace op { template WOpOutputToCvMat::WOpOutputToCvMat(const std::shared_ptr& opOutputToCvMat) : spOpOutputToCvMat{opOutputToCvMat} { } template WOpOutputToCvMat::~WOpOutputToCvMat() { } template void WOpOutputToCvMat::initializationOnThread() { } template void WOpOutputToCvMat::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__); // float* -> cv::Mat for (auto& tDatumPtr : *tDatums) tDatumPtr->cvOutputData = spOpOutputToCvMat->formatToCvMat(tDatumPtr->outputData); // 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(WOpOutputToCvMat); } #endif // OPENPOSE_CORE_W_OP_OUTPUT_TO_CV_MAT_HPP