Skip to content

Commit b44b83c

Browse files
Removed redundant function arguments
1 parent 38974f1 commit b44b83c

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

doc/release_notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ OpenPose Library - Release Notes
156156
1. Heatmaps can be saved in floating format.
157157
2. More efficient non-processing version (i.e. if all keypoint extractors are disabled, and only image extraction and display/saving operations are performed).
158158
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.
159+
4. Detector of the number of GPU also considers the initial GPU index given by the user.
159160
2. Functions or parameters renamed:
160161
1. `PoseParameters` splitted into `PoseParameters` and `PoseParametersRender` and const parameters turned into functions for more clarity.
161162
3. Main bugs fixed:
162163
1. Render working on images > 4K (#324).
164+
2. Cleaned redundant arguments on `getAverageScore` and `getKeypointsArea`.

include/openpose/utilities/keypoint.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ namespace op
2222
const float threshold);
2323

2424
OP_API Rectangle<float> getKeypointsRectangle(const Array<float>& keypoints, const int person,
25-
const int numberKeypoints, const float threshold);
25+
const float threshold);
2626

2727
OP_API float getAverageScore(const Array<float>& keypoints, const int person);
2828

29-
OP_API float getKeypointsArea(const Array<float>& keypoints, const int person, const int numberKeypoints,
30-
const float threshold);
29+
OP_API float getKeypointsArea(const Array<float>& keypoints, const int person, const float threshold);
3130

3231
OP_API int getBiggestPerson(const Array<float>& keypoints, const float threshold);
3332
}

src/openpose/hand/handDetector.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ namespace op
194194
mCurrentId = id;
195195
// Parameters
196196
const auto numberPeople = handKeypoints.at(0).getSize(0);
197-
const auto handNumberParts = handKeypoints[0].getSize(1);
198197
const auto thresholdRectangle = 0.25f;
199198
// Update pose keypoints and hand rectangles
200199
mPoseTrack.resize(numberPeople);
@@ -206,14 +205,14 @@ namespace op
206205
// Left hand
207206
if (getAverageScore(handKeypoints[0], person) > scoreThreshold)
208207
{
209-
const auto handLeftRectangle = getKeypointsRectangle(handKeypoints[0], person, handNumberParts, thresholdRectangle);
208+
const auto handLeftRectangle = getKeypointsRectangle(handKeypoints[0], person, thresholdRectangle);
210209
if (handLeftRectangle.area() > 0)
211210
mHandLeftPrevious.emplace_back(handLeftRectangle);
212211
}
213212
// Right hand
214213
if (getAverageScore(handKeypoints[1], person) > scoreThreshold)
215214
{
216-
const auto handRightRectangle = getKeypointsRectangle(handKeypoints[1], person, handNumberParts, thresholdRectangle);
215+
const auto handRightRectangle = getKeypointsRectangle(handKeypoints[1], person, thresholdRectangle);
217216
if (handRightRectangle.area() > 0)
218217
mHandRightPrevious.emplace_back(handRightRectangle);
219218
}

src/openpose/hand/handExtractorCaffe.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ namespace op
100100
}
101101

102102
Rectangle<float> getHandRectangle(Array<float>& handCurrent, const int person, const float increaseRatio,
103-
const int handNumberParts, const float thresholdRectangle,
103+
const float thresholdRectangle,
104104
const Rectangle<float>& previousHandRectangle = Rectangle<float>{})
105105
{
106106
try
107107
{
108108
// Initial Rectangle
109-
auto handRectangle = getKeypointsRectangle(handCurrent, person, handNumberParts, thresholdRectangle);
109+
auto handRectangle = getKeypointsRectangle(handCurrent, person, thresholdRectangle);
110110
// Get final width
111111
auto finalWidth = fastMax(handRectangle.width, handRectangle.height) * increaseRatio;
112112
if (previousHandRectangle.width > 0 && previousHandRectangle.height > 0)

src/openpose/utilities/keypoint.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ namespace op
164164
// Keypoints
165165
for (auto person = 0 ; person < keypoints.getSize(0) ; person++)
166166
{
167-
const auto personRectangle = getKeypointsRectangle(keypoints, person, numberKeypoints,
168-
thresholdRectangle);
167+
const auto personRectangle = getKeypointsRectangle(keypoints, person, thresholdRectangle);
169168
if (personRectangle.area() > 0)
170169
{
171170
const auto ratioAreas = fastMin(1.f, fastMax(personRectangle.width/(float)width,
@@ -224,11 +223,11 @@ namespace op
224223
}
225224
}
226225

227-
Rectangle<float> getKeypointsRectangle(const Array<float>& keypoints, const int person, const int numberKeypoints,
228-
const float threshold)
226+
Rectangle<float> getKeypointsRectangle(const Array<float>& keypoints, const int person, const float threshold)
229227
{
230228
try
231229
{
230+
const auto numberKeypoints = keypoints.getSize(1);
232231
// Security checks
233232
if (numberKeypoints < 1)
234233
error("Number body parts must be > 0", __LINE__, __FUNCTION__, __FILE__);
@@ -292,12 +291,11 @@ namespace op
292291
}
293292
}
294293

295-
float getKeypointsArea(const Array<float>& keypoints, const int person, const int numberKeypoints,
296-
const float threshold)
294+
float getKeypointsArea(const Array<float>& keypoints, const int person, const float threshold)
297295
{
298296
try
299297
{
300-
return getKeypointsRectangle(keypoints, person, numberKeypoints, threshold).area();
298+
return getKeypointsRectangle(keypoints, person, threshold).area();
301299
}
302300
catch (const std::exception& e)
303301
{
@@ -313,12 +311,11 @@ namespace op
313311
if (!keypoints.empty())
314312
{
315313
const auto numberPeople = keypoints.getSize(0);
316-
const auto numberKeypoints = keypoints.getSize(1);
317314
auto biggestPoseIndex = -1;
318315
auto biggestArea = -1.f;
319316
for (auto person = 0 ; person < numberPeople ; person++)
320317
{
321-
const auto newPersonArea = getKeypointsArea(keypoints, person, numberKeypoints, threshold);
318+
const auto newPersonArea = getKeypointsArea(keypoints, person, threshold);
322319
if (newPersonArea > biggestArea)
323320
{
324321
biggestArea = newPersonArea;

0 commit comments

Comments
 (0)