提交 b44b83cd 编写于 作者: G gineshidalgo99

Removed redundant function arguments

上级 38974f14
......@@ -156,7 +156,9 @@ OpenPose Library - Release Notes
1. Heatmaps can be saved in floating format.
2. More efficient non-processing version (i.e. if all keypoint extractors are disabled, and only image extraction and display/saving operations are performed).
3. Heat maps scaling: Added `heatmaps_scale` to OpenPoseDemo, added option not to scale the heatmaps, and added custom `float` format to save heatmaps in floating format.
4. Detector of the number of GPU also considers the initial GPU index given by the user.
2. Functions or parameters renamed:
1. `PoseParameters` splitted into `PoseParameters` and `PoseParametersRender` and const parameters turned into functions for more clarity.
3. Main bugs fixed:
1. Render working on images > 4K (#324).
2. Cleaned redundant arguments on `getAverageScore` and `getKeypointsArea`.
......@@ -22,12 +22,11 @@ namespace op
const float threshold);
OP_API Rectangle<float> getKeypointsRectangle(const Array<float>& keypoints, const int person,
const int numberKeypoints, const float threshold);
const float threshold);
OP_API float getAverageScore(const Array<float>& keypoints, const int person);
OP_API float getKeypointsArea(const Array<float>& keypoints, const int person, const int numberKeypoints,
const float threshold);
OP_API float getKeypointsArea(const Array<float>& keypoints, const int person, const float threshold);
OP_API int getBiggestPerson(const Array<float>& keypoints, const float threshold);
}
......
......@@ -194,7 +194,6 @@ namespace op
mCurrentId = id;
// Parameters
const auto numberPeople = handKeypoints.at(0).getSize(0);
const auto handNumberParts = handKeypoints[0].getSize(1);
const auto thresholdRectangle = 0.25f;
// Update pose keypoints and hand rectangles
mPoseTrack.resize(numberPeople);
......@@ -206,14 +205,14 @@ namespace op
// Left hand
if (getAverageScore(handKeypoints[0], person) > scoreThreshold)
{
const auto handLeftRectangle = getKeypointsRectangle(handKeypoints[0], person, handNumberParts, thresholdRectangle);
const auto handLeftRectangle = getKeypointsRectangle(handKeypoints[0], person, thresholdRectangle);
if (handLeftRectangle.area() > 0)
mHandLeftPrevious.emplace_back(handLeftRectangle);
}
// Right hand
if (getAverageScore(handKeypoints[1], person) > scoreThreshold)
{
const auto handRightRectangle = getKeypointsRectangle(handKeypoints[1], person, handNumberParts, thresholdRectangle);
const auto handRightRectangle = getKeypointsRectangle(handKeypoints[1], person, thresholdRectangle);
if (handRightRectangle.area() > 0)
mHandRightPrevious.emplace_back(handRightRectangle);
}
......
......@@ -100,13 +100,13 @@ namespace op
}
Rectangle<float> getHandRectangle(Array<float>& handCurrent, const int person, const float increaseRatio,
const int handNumberParts, const float thresholdRectangle,
const float thresholdRectangle,
const Rectangle<float>& previousHandRectangle = Rectangle<float>{})
{
try
{
// Initial Rectangle
auto handRectangle = getKeypointsRectangle(handCurrent, person, handNumberParts, thresholdRectangle);
auto handRectangle = getKeypointsRectangle(handCurrent, person, thresholdRectangle);
// Get final width
auto finalWidth = fastMax(handRectangle.width, handRectangle.height) * increaseRatio;
if (previousHandRectangle.width > 0 && previousHandRectangle.height > 0)
......
......@@ -164,8 +164,7 @@ namespace op
// Keypoints
for (auto person = 0 ; person < keypoints.getSize(0) ; person++)
{
const auto personRectangle = getKeypointsRectangle(keypoints, person, numberKeypoints,
thresholdRectangle);
const auto personRectangle = getKeypointsRectangle(keypoints, person, thresholdRectangle);
if (personRectangle.area() > 0)
{
const auto ratioAreas = fastMin(1.f, fastMax(personRectangle.width/(float)width,
......@@ -224,11 +223,11 @@ namespace op
}
}
Rectangle<float> getKeypointsRectangle(const Array<float>& keypoints, const int person, const int numberKeypoints,
const float threshold)
Rectangle<float> getKeypointsRectangle(const Array<float>& keypoints, const int person, const float threshold)
{
try
{
const auto numberKeypoints = keypoints.getSize(1);
// Security checks
if (numberKeypoints < 1)
error("Number body parts must be > 0", __LINE__, __FUNCTION__, __FILE__);
......@@ -292,12 +291,11 @@ namespace op
}
}
float getKeypointsArea(const Array<float>& keypoints, const int person, const int numberKeypoints,
const float threshold)
float getKeypointsArea(const Array<float>& keypoints, const int person, const float threshold)
{
try
{
return getKeypointsRectangle(keypoints, person, numberKeypoints, threshold).area();
return getKeypointsRectangle(keypoints, person, threshold).area();
}
catch (const std::exception& e)
{
......@@ -313,12 +311,11 @@ namespace op
if (!keypoints.empty())
{
const auto numberPeople = keypoints.getSize(0);
const auto numberKeypoints = keypoints.getSize(1);
auto biggestPoseIndex = -1;
auto biggestArea = -1.f;
for (auto person = 0 ; person < numberPeople ; person++)
{
const auto newPersonArea = getKeypointsArea(keypoints, person, numberKeypoints, threshold);
const auto newPersonArea = getKeypointsArea(keypoints, person, threshold);
if (newPersonArea > biggestArea)
{
biggestArea = newPersonArea;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册