OpenPose  1.7.0
The first real-time multi-person system to jointly detect human body, hand, facial, and foot keypoints
poseExtractor.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_POSE_POSE_EXTRACTOR_HPP
2 #define OPENPOSE_POSE_POSE_EXTRACTOR_HPP
3 
11 
12 namespace op
13 {
15  {
16  public:
17  PoseExtractor(const std::shared_ptr<PoseExtractorNet>& poseExtractorNet,
18  const std::shared_ptr<KeepTopNPeople>& keepTopNPeople = nullptr,
19  const std::shared_ptr<PersonIdExtractor>& personIdExtractor = nullptr,
20  const std::shared_ptr<std::vector<std::shared_ptr<PersonTracker>>>& personTracker = {},
21  const int numberPeopleMax = -1, const int tracking = -1);
22 
23  virtual ~PoseExtractor();
24 
26 
27  void forwardPass(const std::vector<Array<float>>& inputNetData,
28  const Point<int>& inputDataSize,
29  const std::vector<double>& scaleRatios,
30  const Array<float>& poseNetOutput = Array<float>{},
31  const long long frameId = -1ll);
32 
33  // PoseExtractorNet functions
35 
36  std::vector<std::vector<std::array<float, 3>>> getCandidatesCopy() const;
37 
39 
41 
42  float getScaleNetToOutput() const;
43 
44  // KeepTopNPeople functions
45  void keepTopPeople(Array<float>& poseKeypoints, const Array<float>& poseScores) const;
46 
47  // PersonIdExtractor functions
48  // Not thread-safe
49  Array<long long> extractIds(const Array<float>& poseKeypoints, const Matrix& cvMatInput,
50  const unsigned long long imageIndex = 0ull);
51 
52  // Same than extractIds but thread-safe
53  Array<long long> extractIdsLockThread(const Array<float>& poseKeypoints, const Matrix& cvMatInput,
54  const unsigned long long imageIndex,
55  const long long frameId);
56 
57  // PersonTracker functions
58  void track(Array<float>& poseKeypoints, Array<long long>& poseIds,
59  const Matrix& cvMatInput, const unsigned long long imageViewIndex = 0ull);
60 
61  void trackLockThread(Array<float>& poseKeypoints, Array<long long>& poseIds,
62  const Matrix& cvMatInput,
63  const unsigned long long imageViewIndex,
64  const long long frameId);
65 
66  private:
67  const int mNumberPeopleMax;
68  const int mTracking;
69  const std::shared_ptr<PoseExtractorNet> spPoseExtractorNet;
70  const std::shared_ptr<KeepTopNPeople> spKeepTopNPeople;
71  const std::shared_ptr<PersonIdExtractor> spPersonIdExtractor;
72  const std::shared_ptr<std::vector<std::shared_ptr<PersonTracker>>> spPersonTrackers;
73 
75  };
76 }
77 
78 #endif // OPENPOSE_POSE_POSE_EXTRACTOR_HPP
Array< long long > extractIds(const Array< float > &poseKeypoints, const Matrix &cvMatInput, const unsigned long long imageIndex=0ull)
void keepTopPeople(Array< float > &poseKeypoints, const Array< float > &poseScores) const
Array< float > getPoseKeypoints() const
void forwardPass(const std::vector< Array< float >> &inputNetData, const Point< int > &inputDataSize, const std::vector< double > &scaleRatios, const Array< float > &poseNetOutput=Array< float >{}, const long long frameId=-1ll)
Array< float > getHeatMapsCopy() const
virtual ~PoseExtractor()
Array< long long > extractIdsLockThread(const Array< float > &poseKeypoints, const Matrix &cvMatInput, const unsigned long long imageIndex, const long long frameId)
void initializationOnThread()
void track(Array< float > &poseKeypoints, Array< long long > &poseIds, const Matrix &cvMatInput, const unsigned long long imageViewIndex=0ull)
PoseExtractor(const std::shared_ptr< PoseExtractorNet > &poseExtractorNet, const std::shared_ptr< KeepTopNPeople > &keepTopNPeople=nullptr, const std::shared_ptr< PersonIdExtractor > &personIdExtractor=nullptr, const std::shared_ptr< std::vector< std::shared_ptr< PersonTracker >>> &personTracker={}, const int numberPeopleMax=-1, const int tracking=-1)
void trackLockThread(Array< float > &poseKeypoints, Array< long long > &poseIds, const Matrix &cvMatInput, const unsigned long long imageViewIndex, const long long frameId)
std::vector< std::vector< std::array< float, 3 > > > getCandidatesCopy() const
float getScaleNetToOutput() const
Array< float > getPoseScores() const
#define OP_API
Definition: macros.hpp:18
#define DELETE_COPY(className)
Definition: macros.hpp:32