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
op::HandExtractor Class Referenceabstract

#include <handExtractor.hpp>

Inherited by op::HandExtractorCaffe.

Public Member Functions

 HandExtractor (const Point< int > &netInputSize, const Point< int > &netOutputSize, const unsigned short numberScales=1, const float rangeScales=0.4f, const std::vector< HeatMapType > &heatMapTypes={}, const ScaleMode heatMapScale=ScaleMode::ZeroToOne)
 
virtual ~HandExtractor ()
 
void initializationOnThread ()
 
virtual void forwardPass (const std::vector< std::array< Rectangle< float >, 2 >> handRectangles, const cv::Mat &cvInputData, const double scaleInputToOutput)=0
 
std::array< Array< float >, 2 > getHeatMaps () const
 
std::array< Array< float >, 2 > getHandKeypoints () const
 

Protected Member Functions

virtual void netInitializationOnThread ()=0
 

Protected Attributes

const std::pair< unsigned
short, float > 
mMultiScaleNumberAndRange
 
const Point< int > mNetOutputSize
 
Array< float > mHandImageCrop
 
std::array< Array< float >, 2 > mHandKeypoints
 
const ScaleMode mHeatMapScaleMode
 
const std::vector< HeatMapTypemHeatMapTypes
 
std::array< Array< float >, 2 > mHeatMaps
 

Detailed Description

Hand keypoint extractor class.

Constructor & Destructor Documentation

op::HandExtractor::HandExtractor ( const Point< int > &  netInputSize,
const Point< int > &  netOutputSize,
const unsigned short  numberScales = 1,
const float  rangeScales = 0.4f,
const std::vector< HeatMapType > &  heatMapTypes = {},
const ScaleMode  heatMapScale = ScaleMode::ZeroToOne 
)
explicit

Constructor of the HandExtractor class.

Parameters
netInputSizeSize at which the cropped image (where the hand is located) is resized.
netOutputSizeSize of the final results. At the moment, it must be equal than netOutputSize.
numberScalesNumber of scales to run. The more scales, the slower it will be but possibly also more accurate.
rangeScalesThe range between the smaller and bigger scale.
virtual op::HandExtractor::~HandExtractor ( )
virtual

Virtual destructor of the HandExtractor class. Required to allow inheritance.

Member Function Documentation

virtual void op::HandExtractor::forwardPass ( const std::vector< std::array< Rectangle< float >, 2 >>  handRectangles,
const cv::Mat &  cvInputData,
const double  scaleInputToOutput 
)
pure virtual

This function extracts the hand keypoints for each detected hand in the image.

Parameters
handRectangleslocation of the hands in the image. It is a length-variable std::vector, where each index corresponds to a different person in the image. Internally the std::vector, a std::array of 2 elements: index 0 and 1 for left and right hand respectively. Inside each array element, a op::Rectangle<float> (similar to cv::Rect for floating values) with the position of that hand (or 0,0,0,0 if some hand is missing, e.g. if a specific person has only half of the body inside the image).
cvInputDataOriginal image in cv::Mat format and BGR format.
scaleInputToOutputDesired scale of the final keypoints. Set to 1 if the desired size is the cvInputData size.

Implemented in op::HandExtractorCaffe.

std::array<Array<float>, 2> op::HandExtractor::getHandKeypoints ( ) const

This function returns the hand keypoins. VERY IMPORTANT: use getHandKeypoints().clone() if the keypoints are going to be edited in a different thread.

Returns
A std::array with all the left hand keypoints (index 0) and all the right ones (index 1). Each Array<float> follows the pose structure, i.e. the first dimension corresponds to all the people in the image, the second to each specific keypoint, and the third one to (x, y, score).
std::array<Array<float>, 2> op::HandExtractor::getHeatMaps ( ) const
void op::HandExtractor::initializationOnThread ( )

This function must be call before using any other function. It must also be called inside the thread in which the functions are going to be used.

virtual void op::HandExtractor::netInitializationOnThread ( )
protectedpure virtual

Implemented in op::HandExtractorCaffe.

Member Data Documentation

Array<float> op::HandExtractor::mHandImageCrop
protected
std::array<Array<float>, 2> op::HandExtractor::mHandKeypoints
protected
std::array<Array<float>, 2> op::HandExtractor::mHeatMaps
protected
const ScaleMode op::HandExtractor::mHeatMapScaleMode
protected
const std::vector<HeatMapType> op::HandExtractor::mHeatMapTypes
protected
const std::pair<unsigned short, float> op::HandExtractor::mMultiScaleNumberAndRange
protected
const Point<int> op::HandExtractor::mNetOutputSize
protected

The documentation for this class was generated from the following file: