I tried capturing video using Raspberry Pi 4 Model B 8GB RAM and OS of 64 bit. But unable to capture a video due to c2 error. Along with that I'm having no camera in interface option so I updated then libcamera interface=1 is shown. What should I do to capture a video?
import cv2
cam = cv2.VideoCapture(0)
face_cascade = cv2.CascadeClassifier("./opencv-4.x/data/haarcascades/haarcascade frontalface default.xml")
def detect_face(img):
coord = face_cascade.detectMultiScale(img)
for (x,y,w,h) in coord:
cv2.rectangle(img, (x,y), (x+w,y+h), (255, 255, 255),5)
return img
while True:
(ret, image) = cam.read()
image detect_face(image)
cv2.imshow('Preview', image)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
Typo error missing underscore and equal.
Edit: Using Bullseye and Bookworm.
Change this:
to:
Change this:
to: