I'm using openCV version 4.9.0, I believe it's latest.That sounds like you're using an old version of OpenCV. What OS are you using? It might be worth you upgrading. Both Bullseye and Bookworm have libopencv and python3opencv that work with the libcamera interface.I'm trying to use openCV in my project which is not working with new camera driver/library but working with legacy camera.
Here are the rpi OS details:
Code:
pi@cm4-001:~/Desktop $ cat /etc/os-releasePRETTY_NAME="Debian GNU/Linux 11 (bullseye)"NAME="Debian GNU/Linux"VERSION_ID="11"VERSION="11 (bullseye)"VERSION_CODENAME=bullseyeID=debianHOME_URL="https://www.debian.org/"SUPPORT_URL="https://www.debian.org/support"BUG_REPORT_URL="https://bugs.debian.org/"
I have tested multiple times If have with "libcamera" openCV's "VideoCapture" method doesn't work, every time it returns you a ''False", "None".
here is the code snippet:
Code:
import timeimport cv2spice_cam = cv2.VideoCapture(0)time.sleep(1)ret, frame = spice_cam.read()print(ret, frame)spice_cam.release()if not ret: print("Error capturing frame") exit(1)cv2.imwrite("catch.png", frame)pi@cm4-001:~/Desktop $ /usr/bin/python /home/pi/Desktop/new.pyFalse NoneError capturing frame
Statistics: Posted by neetesh — Tue Feb 06, 2024 12:10 pm