frameDisplayer.hpp 2.3 KB
Newer Older
1 2
#ifndef OPENPOSE_GUI_FRAMES_DISPLAY_HPP
#define OPENPOSE_GUI_FRAMES_DISPLAY_HPP
G
gineshidalgo99 已提交
3

4
#include <opencv2/core/core.hpp> // cv::Mat
5 6
#include <openpose/core/common.hpp>
#include <openpose/gui/enumClasses.hpp>
G
gineshidalgo99 已提交
7 8 9 10 11 12

namespace op
{
    /**
     *  The FrameDisplayer class is the one presenting visually the processed frame to the user.
     */
G
Gines 已提交
13
    class OP_API FrameDisplayer
G
gineshidalgo99 已提交
14 15 16 17 18
    {
    public:
        /**
         * Constructor of the FrameDisplayer class.
         * @param windowedName const std::string value with the opencv resulting display name. Showed at the top-left part of the window.
19 20
         * @param initialWindowedSize const Point<int> with the initial window output resolution (width and height).
         * @param fullScreen bool from which the FrameDisplayer::GuiDisplayMode property mGuiDisplayMode will be set, i.e. specifying the type of initial display (it can be changed later).
G
gineshidalgo99 已提交
21
         */
22
        FrameDisplayer(const std::string& windowedName = "OpenPose Display", const Point<int>& initialWindowedSize = Point<int>{}, const bool fullScreen = false);
G
gineshidalgo99 已提交
23

24 25 26
        // Due to OpenCV visualization issues (all visualization functions must be in the same thread)
        void initializationOnThread();

G
gineshidalgo99 已提交
27 28 29 30 31 32 33
        /**
         * This function set the new FrameDisplayer::GuiDisplayMode (e.g. full screen).
         * @param displayMode New FrameDisplayer::GuiDisplayMode state.
         */
        void setGuiDisplayMode(const GuiDisplayMode displayMode);

        /**
G
gineshidalgo99 已提交
34
         * This function switch between full screen and windowed modes (e.g. when double-click on video players or Ctrt+Enter are presed).
G
gineshidalgo99 已提交
35 36 37 38 39 40 41 42 43 44 45 46 47
         */
        void switchGuiDisplayMode();

        /**
         * This function displays an image on the display.
         * @param frame cv::Mat image to display.
         * @param waitKeyValue int value that specifies the argument parameter for cv::waitKey (see OpenCV documentation for more information). Special cases: select -1
         * not to use cv::waitKey or 0 for cv::waitKey(0). OpenCV doc: http://docs.opencv.org/2.4/modules/highgui/doc/user_interface.html?highlight=waitkey
         */
        void displayFrame(const cv::Mat& frame, const int waitKeyValue = -1);

    private:
        const std::string mWindowName;
48
        Point<int> mWindowedSize;
G
gineshidalgo99 已提交
49 50 51 52
        GuiDisplayMode mGuiDisplayMode;
    };
}

53
#endif // OPENPOSE_GUI_FRAMES_DISPLAY_HPP