| #ifdef USE_3D_ADAM_MODEL |
| #ifndef OPENPOSE_FILESTREAM_W_BVH_SAVER_HPP |
| #define OPENPOSE_FILESTREAM_W_BVH_SAVER_HPP |
|
|
| #include <openpose/core/common.hpp> |
| #include <openpose/filestream/bvhSaver.hpp> |
| #include <openpose/thread/workerConsumer.hpp> |
|
|
| namespace op |
| { |
| template<typename TDatums> |
| class WBvhSaver : public WorkerConsumer<TDatums> |
| { |
| public: |
| explicit WBvhSaver(const std::shared_ptr<BvhSaver>& bvhSaver); |
|
|
| virtual ~WBvhSaver(); |
|
|
| void initializationOnThread(); |
|
|
| void workConsumer(const TDatums& tDatums); |
|
|
| private: |
| std::shared_ptr<BvhSaver> spBvhSaver; |
|
|
| DELETE_COPY(WBvhSaver); |
| }; |
| } |
|
|
|
|
|
|
|
|
|
|
| |
| #include <openpose/utilities/pointerContainer.hpp> |
| namespace op |
| { |
| template<typename TDatums> |
| WBvhSaver<TDatums>::WBvhSaver(const std::shared_ptr<BvhSaver>& bvhSaver) : |
| spBvhSaver{bvhSaver} |
| { |
| } |
|
|
| template<typename TDatums> |
| WBvhSaver<TDatums>::~WBvhSaver() |
| { |
| } |
|
|
| template<typename TDatums> |
| void WBvhSaver<TDatums>::initializationOnThread() |
| { |
| } |
|
|
| template<typename TDatums> |
| void WBvhSaver<TDatums>::workConsumer(const TDatums& tDatums) |
| { |
| try |
| { |
| if (checkNoNullNorEmpty(tDatums)) |
| { |
| |
| opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); |
| |
| const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); |
| |
| const auto& tDatumPtr = (*tDatums)[0]; |
| if (!tDatumPtr->poseKeypoints3D.empty()) |
| spBvhSaver->updateBvh(tDatumPtr->adamPose, tDatumPtr->adamTranslation, tDatumPtr->j0Vec); |
| |
| Profiler::timerEnd(profilerKey); |
| Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); |
| |
| opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); |
| } |
| } |
| catch (const std::exception& e) |
| { |
| this->stop(); |
| error(e.what(), __LINE__, __FUNCTION__, __FILE__); |
| } |
| } |
|
|
| COMPILE_TEMPLATE_DATUM(WBvhSaver); |
| } |
|
|
| #endif |
| #endif |
|
|