poseRenderer.hpp 2.2 KB
Newer Older
1 2
#ifndef OPENPOSE_POSE_POSE_RENDERER_HPP
#define OPENPOSE_POSE_POSE_RENDERER_HPP
G
gineshidalgo99 已提交
3 4

#include <memory> // std::shared_ptr
G
Gines Hidalgo 已提交
5
#include <openpose/core/array.hpp>
G
gineshidalgo99 已提交
6
#include <openpose/core/enumClasses.hpp>
7
#include <openpose/core/point.hpp>
G
Gines Hidalgo 已提交
8 9
#include <openpose/core/renderer.hpp>
#include <openpose/utilities/macros.hpp>
G
gineshidalgo99 已提交
10 11 12 13 14 15 16 17
#include "poseExtractor.hpp"
#include "poseParameters.hpp"

namespace op
{
    class PoseRenderer : public Renderer
    {
    public:
G
gineshidalgo99 已提交
18 19 20 21
        explicit PoseRenderer(const Point<int>& heatMapsSize, const Point<int>& outputSize, const PoseModel poseModel,
                              const std::shared_ptr<PoseExtractor>& poseExtractor, const bool blendOriginalFrame = true,
                              const float alphaKeypoint = POSE_DEFAULT_ALPHA_KEYPOINT, const float alphaHeatMap = POSE_DEFAULT_ALPHA_HEAT_MAP,
                              const unsigned int elementToRender = 0u, const RenderMode renderMode = RenderMode::Cpu);
G
gineshidalgo99 已提交
22 23 24 25 26 27 28 29 30 31 32 33 34

        ~PoseRenderer();

        void initializationOnThread();

        bool getBlendOriginalFrame() const;

        bool getShowGooglyEyes() const;

        void setBlendOriginalFrame(const bool blendOriginalFrame);

        void setShowGooglyEyes(const bool showGooglyEyes);

35
        std::pair<int, std::string> renderPose(Array<float>& outputData, const Array<float>& poseKeypoints, const float scaleNetToOutput = -1.f);
G
gineshidalgo99 已提交
36 37

    private:
38 39
        const Point<int> mHeatMapsSize;
        const Point<int> mOutputSize;
G
gineshidalgo99 已提交
40
        const PoseModel mPoseModel;
G
Gines Hidalgo 已提交
41
        const std::map<unsigned int, std::string> mPartIndexToName;
G
gineshidalgo99 已提交
42
        const std::shared_ptr<PoseExtractor> spPoseExtractor;
G
gineshidalgo99 已提交
43
        const RenderMode mRenderMode;
G
gineshidalgo99 已提交
44 45 46
        std::atomic<bool> mBlendOriginalFrame;
        std::atomic<bool> mShowGooglyEyes;
        // Init with thread
G
gineshidalgo99 已提交
47 48 49 50 51
        float* pGpuPose; // GPU aux memory

        std::pair<int, std::string> renderPoseCpu(Array<float>& outputData, const Array<float>& poseKeypoints, const float scaleNetToOutput = -1.f);

        std::pair<int, std::string> renderPoseGpu(Array<float>& outputData, const Array<float>& poseKeypoints, const float scaleNetToOutput = -1.f);
G
gineshidalgo99 已提交
52 53 54 55 56

        DELETE_COPY(PoseRenderer);
    };
}

57
#endif // OPENPOSE_POSE_POSE_RENDERER_HPP