I am trying to detect pose from my Webcamera using OpenPifPaf Library (https://openpifpaf.github.io/tutorial_opencv.html). However I am always getting this error, AttributeError: 'NoneType' object has no attribute '__array_interface__'
This is what I have tried
# importing all the libraries
import openpifpaf
import cv2
VIDEO_LINK = 0 # 0 for webcamera
video = cv2.VideoCapture(VIDEO_LINK)
predictor = openpifpaf.Predictor(checkpoint='shufflenetv2k16')
annotation_painter = openpifpaf.show.AnnotationPainter()
while(True):
_, frame = video.read()
predictions, gt_anns, meta = predictor.numpy_image(frame)
# cv2.imshow('frame', frame)
with openpifpaf.show.Canvas.image(frame) as ax:
img = annotation_painter.annotations(ax, predictions)
cv2.imshow('frame2', img)
# to exit the video live
if cv2.waitKey(33) & 0xFF == ord('q'):
break
video.release()
cv2.destroyAllWindows()
I can get the pose estimate in images but I can't get it using video. Any experts advice would help me.
This is the complete error traceback message:
src\openpifpaf\csrc\src\cif_hr.cpp:102: UserInfo: resizing cifhr buffer
src\openpifpaf\csrc\src\occupancy.cpp:53: UserInfo: resizing occupancy buffer
Traceback (most recent call last):
File "d:/Projects/HumanPoseEstimation/openpifpaf_test_on_video.py", line 2, in <module>
import openpifpaf
File "D:\Projects\HumanPoseEstimation\human_pose_estimation_venv\lib\site-packages\openpifpaf\__init__.py", line 41, in <module>
plugin.register()
File "D:\Projects\HumanPoseEstimation\human_pose_estimation_venv\lib\site-packages\openpifpaf\plugin.py", line 31, in register
module = importlib.import_module(name)
File "C:\Users\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "d:\Projects\HumanPoseEstimation\openpifpaf_test_on_video.py", line 16, in <module>
cv2.imshow('frame2', img)
cv2.error: OpenCV(4.8.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:971: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'