5.Running Raspberry Pi Camera Module With OpenCV - NaimFuad/RaspberryPiWithOpenCV GitHub Wiki

Enable Camera On Your Raspberry Pi
- On terminal run the following command
$ sudo raspi-config
- Navigate to Interface Option, on Camera option, choose_ Yes _to enable it.
- Reboot you Raspberry Pi
$ sudo reboot now
- Connect your Raspberry Pi Camera Module to the onboard MIPI connector.
- Create a new Python on Python IDE (or Thonny)script by copy paste the given code and run it.
import cv2
import numpy as np
import time
cap=cv2.VideoCapture(0)
cap.set(3,320) #set heigt >>refer propId
cap.set(4,240) #set width
time.sleep(0.1)
while True:
ret,frame = cap.read()
cv2.imshow('frame',frame)
if cv2.waitKey(1)&0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
