OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
handExtractorNet.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_HAND_HAND_EXTRACTOR_HPP
2 #define OPENPOSE_HAND_HAND_EXTRACTOR_HPP
3 
4 #include <atomic>
5 #include <thread>
6 #include <opencv2/core/core.hpp> // cv::Mat
9 
10 namespace op
11 {
16  {
17  public:
26  explicit HandExtractorNet(const Point<int>& netInputSize, const Point<int>& netOutputSize,
27  const unsigned short numberScales = 1, const float rangeScales = 0.4f,
28  const std::vector<HeatMapType>& heatMapTypes = {},
29  const ScaleMode heatMapScale = ScaleMode::ZeroToOne);
30 
35  virtual ~HandExtractorNet();
36 
41  void initializationOnThread();
42 
52  virtual void forwardPass(const std::vector<std::array<Rectangle<float>, 2>> handRectangles,
53  const cv::Mat& cvInputData) = 0;
54 
55  std::array<Array<float>, 2> getHeatMaps() const;
56 
64  std::array<Array<float>, 2> getHandKeypoints() const;
65 
66  bool getEnabled() const;
67 
68  void setEnabled(const bool enabled);
69 
70  protected:
71  const std::pair<unsigned short, float> mMultiScaleNumberAndRange;
74  std::array<Array<float>, 2> mHandKeypoints;
75  // HeatMaps parameters
77  const std::vector<HeatMapType> mHeatMapTypes;
78  std::array<Array<float>, 2> mHeatMaps;
79  // Temporarily disable it
80  std::atomic<bool> mEnabled;
81 
82  virtual void netInitializationOnThread() = 0;
83 
84  private:
85  // Init with thread
86  std::thread::id mThreadId;
87 
88  void checkThread() const;
89 
91  };
92 }
93 
94 #endif // OPENPOSE_HAND_HAND_EXTRACTOR_HPP
#define DELETE_COPY(className)
Definition: macros.hpp:31
std::array< T, N > array
Definition: cl2.hpp:594
std::atomic< bool > mEnabled
Definition: handExtractorNet.hpp:80
Array< float > mHandImageCrop
Definition: handExtractorNet.hpp:73
const ScaleMode mHeatMapScaleMode
Definition: handExtractorNet.hpp:76
const Point< int > mNetOutputSize
Definition: handExtractorNet.hpp:72
const std::pair< unsigned short, float > mMultiScaleNumberAndRange
Definition: handExtractorNet.hpp:71
std::array< Array< float >, 2 > mHandKeypoints
Definition: handExtractorNet.hpp:74
std::array< Array< float >, 2 > mHeatMaps
Definition: handExtractorNet.hpp:78
ScaleMode
Definition: enumClasses.hpp:6
Definition: rectangle.hpp:11
Definition: handExtractorNet.hpp:15
std::vector< T, Alloc > vector
Definition: cl2.hpp:567
#define OP_API
Definition: macros.hpp:16
const std::vector< HeatMapType > mHeatMapTypes
Definition: handExtractorNet.hpp:77