OpenPose  1.7.0
The first real-time multi-person system to jointly detect human body, hand, facial, and foot keypoints
datum.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_CORE_DATUM_HPP
2 #define OPENPOSE_CORE_DATUM_HPP
3 
4 #ifdef USE_3D_ADAM_MODEL
5  #ifdef USE_EIGEN
6  #include <Eigen/Core>
7  #endif
8 #endif
10 
11 namespace op
12 {
19  struct OP_API Datum
20  {
21  // ---------------------------------------- ID parameters ---------------------------------------- //
22  unsigned long long id;
24  unsigned long long subId;
26  unsigned long long subIdMax;
31  std::string name;
32 
38  unsigned long long frameNumber;
39 
40  // ------------------------------ Input image and rendered version parameters ------------------------------ //
46 
56  std::vector<Array<float>> inputNetData;
57 
65 
73 
78 
79  // ------------------------------ Resulting Array<float> data parameters ------------------------------ //
86 
95 
105 
119 
129  std::vector<std::vector<std::array<float,3>>> poseCandidates;
130 
136  std::vector<Rectangle<float>> faceRectangles;
137 
144 
151 
157  std::vector<std::array<Rectangle<float>, 2>> handRectangles;
158 
165  std::array<Array<float>, 2> handKeypoints;
166 
172  std::array<Array<float>, 2> handHeatMaps;
173 
174  // ---------------------------------------- 3-D Reconstruction parameters ---------------------------------------- //
180 
187 
194  std::array<Array<float>, 2> handKeypoints3D;
195 
200 
205 
210 
218 
219  // ---------------------------------------- Other (internal) parameters ---------------------------------------- //
223  std::vector<double> scaleInputToNetInputs;
224 
229  std::vector<Point<int>> netInputSizes;
230 
235 
240 
245 
250  std::pair<int, std::string> elementRendered;
251 
252  // 3D/Adam parameters (experimental code not meant to be publicly used)
253  #ifdef USE_3D_ADAM_MODEL
254  // Adam/Unity params
255  std::vector<double> adamPosePtr;
256  int adamPoseRows;
257  std::vector<double> adamTranslationPtr;
258  std::vector<double> vtVecPtr;
259  int vtVecRows;
260  std::vector<double> j0VecPtr;
261  int j0VecRows;
262  std::vector<double> adamFaceCoeffsExpPtr;
263  int adamFaceCoeffsExpRows;
264  #ifdef USE_EIGEN
265  // Adam/Unity params
266  Eigen::Matrix<double, 62, 3, Eigen::RowMajor> adamPose;
267  Eigen::Vector3d adamTranslation;
268  // Adam params (Jacobians)
269  Eigen::Matrix<double, Eigen::Dynamic, 1> vtVec;
270  Eigen::Matrix<double, Eigen::Dynamic, 1> j0Vec;
271  Eigen::VectorXd adamFaceCoeffsExp;
272  #endif
273  #endif
274 
275 
276 
277 
278 
279  // ---------------------------------------- Functions ---------------------------------------- //
285  explicit Datum();
286 
295  Datum(const Datum& datum);
296 
303  Datum& operator=(const Datum& datum);
304 
310  Datum(Datum&& datum);
311 
318  Datum& operator=(Datum&& datum);
319 
324  virtual ~Datum();
325 
333  Datum clone() const;
334 
335 
336 
337 
338 
339  // ---------------------------------------- Comparison operators ---------------------------------------- //
345  inline bool operator<(const Datum& datum) const
346  {
347  // return id < datum.id;
348  return id < datum.id || (id == datum.id && subId < datum.subId);
349  }
355  inline bool operator>(const Datum& datum) const
356  {
357  // return id > datum.id;
358  return id > datum.id || (id == datum.id && subId > datum.subId);
359  }
365  inline bool operator<=(const Datum& datum) const
366  {
367  // return id <= datum.id;
368  return id < datum.id || (id == datum.id && subId <= datum.subId);
369  }
375  inline bool operator>=(const Datum& datum) const
376  {
377  // return id >= datum.id;
378  return id > datum.id || (id == datum.id && subId >= datum.subId);
379  }
385  inline bool operator==(const Datum& datum) const
386  {
387  // return id == datum.id;
388  return id == datum.id && subId == datum.subId;
389  }
395  inline bool operator!=(const Datum& datum) const
396  {
397  // return id != datum.id;
398  return id != datum.id || subId != datum.subId;
399  }
400  };
401 
402  // Defines for Datum. Added here rather than in `macros.hpp` to avoid circular dependencies
403  #define BASE_DATUM Datum
404  #define BASE_DATUMS std::vector<std::shared_ptr<BASE_DATUM>>
405  #define BASE_DATUMS_SH std::shared_ptr<BASE_DATUMS>
406  #define DEFINE_TEMPLATE_DATUM(templateName) template class OP_API templateName<BASE_DATUMS_SH>
407  #define COMPILE_TEMPLATE_DATUM(templateName) extern template class templateName<BASE_DATUMS_SH>
408 }
409 
410 #endif // OPENPOSE_CORE_DATUM_HPP
#define OP_API
Definition: macros.hpp:18
Matrix cvOutputData3D
Definition: datum.hpp:77
std::vector< Rectangle< float > > faceRectangles
Definition: datum.hpp:136
std::vector< double > scaleInputToNetInputs
Definition: datum.hpp:223
virtual ~Datum()
Matrix cvInputData
Definition: datum.hpp:45
Datum & operator=(Datum &&datum)
std::array< Array< float >, 2 > handKeypoints3D
Definition: datum.hpp:194
Datum(Datum &&datum)
bool operator<=(const Datum &datum) const
Definition: datum.hpp:365
std::vector< Point< int > > netInputSizes
Definition: datum.hpp:229
std::pair< int, std::string > elementRendered
Definition: datum.hpp:250
Array< float > outputData
Definition: datum.hpp:64
Datum(const Datum &datum)
double scaleNetToOutput
Definition: datum.hpp:244
std::vector< Array< float > > inputNetData
Definition: datum.hpp:56
std::vector< std::array< Rectangle< float >, 2 > > handRectangles
Definition: datum.hpp:157
Array< float > poseHeatMaps
Definition: datum.hpp:118
std::vector< std::vector< std::array< float, 3 > > > poseCandidates
Definition: datum.hpp:129
std::array< Array< float >, 2 > handKeypoints
Definition: datum.hpp:165
Array< float > poseKeypoints3D
Definition: datum.hpp:179
unsigned long long id
Definition: datum.hpp:22
double scaleInputToOutput
Definition: datum.hpp:234
Array< float > poseKeypoints
Definition: datum.hpp:85
Datum & operator=(const Datum &datum)
bool operator>(const Datum &datum) const
Definition: datum.hpp:355
bool operator!=(const Datum &datum) const
Definition: datum.hpp:395
unsigned long long frameNumber
Definition: datum.hpp:38
Array< float > poseNetOutput
Definition: datum.hpp:217
Array< float > faceKeypoints3D
Definition: datum.hpp:186
bool operator<(const Datum &datum) const
Definition: datum.hpp:345
Matrix cameraMatrix
Definition: datum.hpp:199
Matrix cameraExtrinsics
Definition: datum.hpp:204
unsigned long long subIdMax
Definition: datum.hpp:26
bool operator>=(const Datum &datum) const
Definition: datum.hpp:375
Array< long long > poseIds
Definition: datum.hpp:94
Point< int > netOutputSize
Definition: datum.hpp:239
Datum clone() const
Matrix cvOutputData
Definition: datum.hpp:72
Array< float > faceHeatMaps
Definition: datum.hpp:150
Matrix cameraIntrinsics
Definition: datum.hpp:209
std::string name
Definition: datum.hpp:31
bool operator==(const Datum &datum) const
Definition: datum.hpp:385
unsigned long long subId
Definition: datum.hpp:24
Array< float > faceKeypoints
Definition: datum.hpp:143
std::array< Array< float >, 2 > handHeatMaps
Definition: datum.hpp:172
Array< float > poseScores
Definition: datum.hpp:104