Skip to content

Commit 3bd5ed1

Browse files
Added hand extractor API doc
1 parent c2e5d5d commit 3bd5ed1

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

include/openpose/hand/handExtractor.hpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,49 @@
1111

1212
namespace op
1313
{
14+
/**
15+
* Hand keypoint extractor class.
16+
*/
1417
class OP_API HandExtractor
1518
{
1619
public:
20+
/**
21+
* Constructor of the HandExtractor class.
22+
* @param netInputSize Size at which the cropped image (where the hand is located) is resized.
23+
* @param netOutputSize Size of the final results. At the moment, it must be equal than netOutputSize.
24+
* @param modelFolder Folder where the models are located.
25+
* @param gpuId The GPU index (0-based) which the deep net will use.
26+
* @param numberScales Number of scales to run. The more scales, the slower it will be but possibly also more accurate.
27+
* @param rangeScales The range between the smaller and bigger scale.
28+
*/
1729
explicit HandExtractor(const Point<int>& netInputSize, const Point<int>& netOutputSize, const std::string& modelFolder, const int gpuId,
1830
const unsigned short numberScales = 1, const float rangeScales = 0.4f);
1931

32+
/**
33+
* This function must be call before using any other function. It must also be called inside the thread in which the functions are going
34+
* to be used.
35+
*/
2036
void initializationOnThread();
2137

38+
/**
39+
* This function extracts the hand keypoints for each detected hand in the image.
40+
* @param fpsMode handRectangles Location of the hands in the image. It is a length-variable std::vector, where each index corresponds to
41+
* 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
42+
* respectively. Inside each array element, a op::Rectangle<float> (similar to cv::Rect for floating values) with the position of that hand
43+
* (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).
44+
* @param cvInputData Original image in cv::Mat format and BGR format.
45+
* @param scaleInputToOutput Desired scale of the final keypoints. Set to 1 if the desired size is the cvInputData size.
46+
*/
2247
void forwardPass(const std::vector<std::array<Rectangle<float>, 2>> handRectangles, const cv::Mat& cvInputData,
2348
const float scaleInputToOutput);
2449

50+
/**
51+
* This function returns the hand keypoins. VERY IMPORTANT: use getHandKeypoints().clone() if the keypoints are going to be edited
52+
* in a different thread.
53+
* @return And std::array with all the left hand keypoints (index 0) and all the right ones (index 1). Each Array<float> follows the pose
54+
* structure, i.e. the first dimension corresponds to all the people in the image, the second to each specific keypoint, and the third
55+
* one to (x, y, score).
56+
*/
2557
std::array<Array<float>, 2> getHandKeypoints() const;
2658

2759
private:

0 commit comments

Comments
 (0)