FORTH-ModelBasedTracker / PyOpenPose

Python bindings for the Openpose library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

detectPose(): Exception "Does not match C++ signature"

rmitsch opened this issue · comments

I've installed the OpenPose at commit CMU-Perceptual-Computing-Lab/openpose@e382698 (as specified in the readme) and the latest version of PyOpenPose.

When executing

cap = cv2.VideoCapture(args.filename)
with_face = with_hands = True
op = OP.OpenPose((656, 368), (368, 368), (1280, 720), "COCO", OPENPOSE_ROOT + os.sep + "models" + os.sep, 0, False, OP.OpenPose.ScaleMode.ZeroToOne, with_face, with_hands)

while True:
    ret, frame = cap.read()
    op.detectPose(frame)

I get the following error:

Traceback (most recent call last):
  File "/pyopenposetest/generate_train_data.py", line 77, in <module>
    run()
  File "/pyopenposetest/generate_train_data.py", line 32, in run
    op.detectPose(frame)
Boost.Python.ArgumentError: Python argument types in
    OpenPose.detectPose(OpenPose, NoneType)
did not match C++ signature:
    detectPose(OpenPoseWrapper {lvalue}, cv::Mat)

Note quite sure what to make of this, since both https://github.com/FORTH-ModelBasedTracker/PyOpenPose/blob/master/scripts/optest.ipynb and https://github.com/FORTH-ModelBasedTracker/PyOpenPose/blob/master/PyOpenPoseLib/OpenPoseWrapper.h seem to confirm that calling detectPose() like this is correct.

Thanks for your time!

Hello,

From the error it looks like frame is None. Propably opencv.capture failed to properly open your camera. Try loading an image from dist (cv2.imread) and passing it to the detectPose instead (or fix the camera issue).

Yes, exactly - was an OpenCV error. Reinstalling opencv-python helped. Thanks for the quick response!