VTuber_Unity icon indicating copy to clipboard operation
VTuber_Unity copied to clipboard

issue on Ubuntu 20.04

Open Divanchik opened this issue 3 years ago • 1 comments

$ 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'

Divanchik avatar Apr 21 '21 18:04 Divanchik

@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, https://github.com/kwea123/VTuber_Unity/blob/ff5e1457d76d00f96eeb9c2ec9cf872f5ed43d0f/demo.py#L58

with

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

Hope this helps.

tkbky avatar May 16 '21 10:05 tkbky