I have camera module 3 but why not i cant use Libraly opencv (In Raspberry Pi 4)
Code
import cv2
cap = cv2.VideoCapture(0)
if not cap.isOpened():
print(“Cant open Camera”)
else:
ret, frame = cap.read()
if ret:
cv2.imshow(‘Camera Output’, frame)
cap.release()
cv2.destroyAllWindows()
but i can open camera with picamera2
Code :
picam2 = Picamera2()
camera_config = picam2.create_still_configuration(main={‘size’ : (2304,1296 )}, lores = {‘size’ : (2304,1296)}, display = ‘lores’)
picam2.configure(camera_config)
picam2.start_preview(Preview.QTGL)
picam2.start()
picam2.capture_file(‘test.jpg’)