#ifndef OPENPOSE_CORE_W_CV_MAT_TO_OP_OUTPUT_HPP #define OPENPOSE_CORE_W_CV_MAT_TO_OP_OUTPUT_HPP #include #include #include namespace op { template class WCvMatToOpOutput : public Worker { public: explicit WCvMatToOpOutput(const std::shared_ptr& cvMatToOpOutput); virtual ~WCvMatToOpOutput(); void initializationOnThread(); void work(TDatums& tDatums); private: const std::shared_ptr spCvMatToOpOutput; DELETE_COPY(WCvMatToOpOutput); }; } // Implementation #include #include namespace op { template WCvMatToOpOutput::WCvMatToOpOutput(const std::shared_ptr& cvMatToOpOutput) : spCvMatToOpOutput{cvMatToOpOutput} { } template WCvMatToOpOutput::~WCvMatToOpOutput() { } template void WCvMatToOpOutput::initializationOnThread() { } template void WCvMatToOpOutput::work(TDatums& tDatums) { try { if (checkNoNullNorEmpty(tDatums)) { // Debugging log opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // T* to T auto& tDatumsNoPtr = *tDatums; // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // cv::Mat -> float* for (auto& tDatumPtr : tDatumsNoPtr) tDatumPtr->outputData = spCvMatToOpOutput->createArray( tDatumPtr->cvInputData, tDatumPtr->scaleInputToOutput, tDatumPtr->netOutputSize); // 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(WCvMatToOpOutput); } #endif // OPENPOSE_CORE_W_CV_MAT_TO_OP_OUTPUT_HPP