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 <openpose/core/common.hpp>
G
gineshidalgo99 已提交
5
#include <openpose/core/enumClasses.hpp>
G
Gines Hidalgo 已提交
6
#include <openpose/core/renderer.hpp>
7 8 9
#include <openpose/pose/enumClasses.hpp>
#include <openpose/pose/poseExtractor.hpp>
#include <openpose/pose/poseParameters.hpp>
G
gineshidalgo99 已提交
10 11 12

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

        ~PoseRenderer();

        void initializationOnThread();

        bool getBlendOriginalFrame() const;

        bool getShowGooglyEyes() const;

        void setBlendOriginalFrame(const bool blendOriginalFrame);

        void setShowGooglyEyes(const bool showGooglyEyes);

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

    private:
G
gineshidalgo99 已提交
37
        const float mRenderThreshold;
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