Open christianbaun opened 2 years ago
Also had a similar issue, anyone have a way of fixing this?
[WARN:0] VIDE0I0(V4L2:/dev/video0): can't open camera by index Traceback (most recent call last): File "TFLite_detection_webcam.py", line 171, in <module> frame = frame1.copy() AttributeError: 'NoneType' object has no attribute 'copy'
I'm using picam on Raspberry Pi OS Buster
Thanks for raising this issue @christianbaun! The new libcamera library is a pain. I haven't taken the time yet to figure out how to make it work with OpenCV. For now, I just enabled the legacy camera library (following these instructions).
If you have time, can you look in to how to get the new libcamera library working with OpenCV and let me know if you find a solution?
When switching from the legacy camera stack under Raspberry Pi OS with debian 10 to the new libcamera camera stack (in Raspberry Pi OS with debian 11 it is standard), the TFLite_detection_webcam.py script does not work any longer.
You can switch in Raspberry Pi OS (debian 10) between both camera stacks by adding/removing the line
camera_auto_detect=1
in the file
/boot/config.txt
.After switching to the new libcamera camera stack, TFLite_detection_webcam.py results in this error message:
Often read recommendations like modify
cv2.VideoCapture(0)
intocv2.VideoCapture(cv2.CAP_V4L2)
orcv2.VideoCapture(1)
orcv2.VideoCapture(-1)
did not help.The camera works well. I tested it with
libcamera-vid -t 0
I also gave
/dev/video0
and/dev/video1
full permissions (777) just to ensure that it is not a permission issue.Has anyone here seen the same issue and solved it?