Skip to content

Instantly share code, notes, and snippets.

@bhomaidan1990
Created April 12, 2021 04:50
Show Gist options
  • Save bhomaidan1990/49b544914af19c2c1113ec20037eab2f to your computer and use it in GitHub Desktop.
Save bhomaidan1990/49b544914af19c2c1113ec20037eab2f to your computer and use it in GitHub Desktop.
grabber script to capture images continuously on a raspberry pi 3 module
import cv2
from time import sleep
resolution = (1024, 768)
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, resolution[0]) # max: 2592
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, resolution[1]) # max: 1944
while(True):
status , frame = cap.read()
cv2.imwrite('/home/pi1/vision/image.jpg', frame)
sleep(1)
cap.release()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment