Openpose: does openpose have output the bounding box of person ( like x,y,w,h

Created on 21 Jun 2017  Â·  15Comments  Â·  Source: CMU-Perceptual-Computing-Lab/openpose

C++ API Python help wantequestion

Most helpful comment

Currently this API is not exposed via Python. I guess it would be worth it to add the utility functions to Python which is something we can do.

@taraprasad73

If you want to add custom functions, for your interest, it is very easy to do. Simply open openpose_python.cpp in the python folder. Then under the PYBIND11_MODULE section, just add say

m.def("get_keypoints_rectangle", &op::getKeypointsRectangle<float>, "Get Keypoints From Rectangle");

All 15 comments

No the demo, but the library has a function for that: getKeypointsRectangle() in include/openpose/utilities/keypoint.hpp

Usage example:

const auto thresholdRectangle = 0.1f;
const auto numberKeypoints = keypoints.getSize(1);
const auto areaKeypoints = numberKeypoints * keypoints.getSize(2);
const auto personRectangle = getKeypointsRectangle(&keypoints[personIndex*areaKeypoints], numberKeypoints, thresholdRectangle);

(from src/openpose/utilities/keypoint.cpp )

Given there is no further answer, I'll assume it was solved.

Is there a way to access getKeypointsRectangle() in python?

@soulslicer

Currently this API is not exposed via Python. I guess it would be worth it to add the utility functions to Python which is something we can do.

@taraprasad73

If you want to add custom functions, for your interest, it is very easy to do. Simply open openpose_python.cpp in the python folder. Then under the PYBIND11_MODULE section, just add say

m.def("get_keypoints_rectangle", &op::getKeypointsRectangle<float>, "Get Keypoints From Rectangle");

@soulslicer Hi, thanks for your answer. I'm not familiar with pybind11. when adding that line of code in openpose_python.cpp, I got an error. Do I have to compile openpose again to make it work?

many thanks.

Yes you would have to recompile it

@gineshidalgo99 thanks for your reply. I recompiled it, unfortunately, I got an error due to the unity plugin is only available on Windows. I am using Ubuntu and don't need to use unity, is there a way to work around and avoid this kind of error? thank you

Can you paste the error? When does it happen?

@soulslicer I think it's an OS support issue. I am using Ubuntu 16.04, the error explained the reason:

Error:
Unity plugin only available on Windows.

Coming from:

  • /home/kevin/git/openpose/src/openpose/utilities/errorAndLog.cpp:DebugInUnity():47

You can enabled WITH_UNITY, which you do not wanna enable. Disable it from CMake

@gineshidalgo99 Many thanks, perfectly solved ! Then I realized the rectangle is drawn by using the maximum and minimum of estimated keypoints (as shown in the image below) , which is not able to cover the whole body. Please bear with me if I have asked too much, is there a way to find an accurate bounding box where the whole body can be fully covered? thanks

openpose 1 4 0 - tutorial python api_screenshot_14 02 2019

No there is not, it is based on the body pose keypoints.

Was it working fine when you have more than one persons in the frame?

@gineshidalgo99 Many thanks, perfectly solved ! Then I realized the rectangle is drawn by using the maximum and minimum of estimated keypoints (as shown in the image below) , which is not able to cover the whole body. Please bear with me if I have asked too much, is there a way to find an accurate bounding box where the whole body can be fully covered? thanks

openpose 1 4 0 - tutorial python api_screenshot_14 02 2019

Hi

Could you please mention how did you run the program to get the rectangle?

Was this page helpful?
0 / 5 - 0 ratings