FORTH-ModelBasedTracker / PyOpenPose

Python bindings for the Openpose library
BSD 3-Clause "New" or "Revised" License
287 stars 80 forks source link

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

Closed rmitsch closed 6 years ago

rmitsch commented 6 years ago

I've installed the OpenPose at commit https://github.com/CMU-Perceptual-Computing-Lab/openpose/commit/e38269862f05beca9497960eef3d35f9eecc0808 (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!

padeler commented 6 years ago

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).

rmitsch commented 6 years ago

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