OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
faceExtractor.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_FACE_FACE_EXTRACTOR_HPP
2 #define OPENPOSE_FACE_FACE_EXTRACTOR_HPP
3 
4 #include <atomic>
5 #include <thread>
6 #include <opencv2/core/core.hpp> // cv::Mat
9 #include <openpose/core/net.hpp>
12 
13 namespace op
14 {
16  {
17  public:
18  explicit FaceExtractor(const Point<int>& netInputSize, const Point<int>& netOutputSize,
19  const std::string& modelFolder, const int gpuId,
20  const std::vector<HeatMapType>& heatMapTypes = {},
21  const ScaleMode heatMapScale = ScaleMode::ZeroToOne);
22 
23  void initializationOnThread();
24 
25  void forwardPass(const std::vector<Rectangle<float>>& faceRectangles, const cv::Mat& cvInputData,
26  const float scaleInputToOutput);
27 
28  Array<float> getFaceKeypoints() const;
29 
30  Array<float> getHeatMaps() const;
31 
32  private:
33  const Point<int> mNetOutputSize;
34  std::shared_ptr<Net> spNet;
35  std::shared_ptr<ResizeAndMergeCaffe<float>> spResizeAndMergeCaffe;
36  std::shared_ptr<MaximumCaffe<float>> spMaximumCaffe;
37  Array<float> mFaceImageCrop;
38  Array<float> mFaceKeypoints;
39  // HeatMaps parameters
40  const ScaleMode mHeatMapScaleMode;
41  const std::vector<HeatMapType> mHeatMapTypes;
42  Array<float> mHeatMaps;
43  // Init with thread
44  boost::shared_ptr<caffe::Blob<float>> spCaffeNetOutputBlob;
45  std::shared_ptr<caffe::Blob<float>> spHeatMapsBlob;
46  std::shared_ptr<caffe::Blob<float>> spPeaksBlob;
47  std::thread::id mThreadId;
48 
49  void checkThread() const;
50 
52  };
53 }
54 
55 #endif // OPENPOSE_FACE_FACE_EXTRACTOR_HPP
#define DELETE_COPY(className)
Definition: macros.hpp:25
ScaleMode
Definition: enumClasses.hpp:6
Definition: rectangle.hpp:10
#define OP_API
Definition: macros.hpp:5
Definition: faceExtractor.hpp:15