Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

issue on Ubuntu 20.04 #21

Open
Divanchik opened this issue Apr 21, 2021 · 1 comment
Open

issue on Ubuntu 20.04 #21

Divanchik opened this issue Apr 21, 2021 · 1 comment

Comments

@Divanchik
Copy link

$ python3 demo.py --debug

[ WARN:0] global /tmp/pip-req-build-ms668fyv/opencv/modules/videoio/src/cap_v4l.cpp (893) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
Traceback (most recent call last):
File "demo.py", line 219, in
main()
File "demo.py", line 62, in main
pose_estimator = PoseEstimator(img_size=sample_frame.shape[:2])
AttributeError: 'NoneType' object has no attribute 'shape'

@tkbky
Copy link

tkbky commented May 16, 2021

@Divanchik

I run into the same issue as well. It looks like it isn't able to read the frame correctly for the first time.

My workaround is to check if the frame is read correctly, if it is not, read again.

What I did is to replace this line,

_, sample_frame = cap.read()

with

ret, sample_frame = cap.read()
while not ret:
    ret, sample_frame = cap.read()

Hope this helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants