Compare commits

...

3 Commits

Author SHA1 Message Date
Jimmy 8ceb9fd08a Basic working example 2022-12-11 03:16:29 +00:00
Jimmy a250aa9eab Ignore jpegs 2022-12-11 03:15:58 +00:00
Jimmy 8013a9e06a Update Readme 2022-12-11 03:15:36 +00:00
3 changed files with 51 additions and 4 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.jpeg
*.jpg

View File

@ -1,5 +1,2 @@
```sudo apt install -y python3-pyqt5 python3-opengl```
```sudo apt install -y python3-picamera2```
```sudo apt install -y python3-opencv opencv-data```

48
pi.py Normal file
View File

@ -0,0 +1,48 @@
#!/usr/bin/python3
import cv2
from gpiozero import LED, Button
from picamera2 import Picamera2
from time import sleep
red = LED(19)
blue = LED(26)
green = LED(13)
button = Button(5)
# Grab images as numpy arrays and leave everything else to OpenCV.
x = 1920
y = 1080
cv2.namedWindow("window", cv2.WND_PROP_FULLSCREEN)
#cv2.setWindowProperty("window",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
cv2.resizeWindow("window", x, y)
picam2 = Picamera2()
capture_config = picam2.create_preview_configuration(main={"size": (x, y),
"format": "RGB888"})
picam2.configure(capture_config)
picam2.start()
while True:
while True:
im = picam2.capture_array()
cv2.imshow("window", im)
if cv2.waitKey(40) & 0xFF == ord('a') or button.value:
break
while button.value:
pass
while not button.value:
sleep(0.1)
while not button.value:
pass
sleep(1)