-
Notifications
You must be signed in to change notification settings - Fork 1
/
camera.py
34 lines (26 loc) · 856 Bytes
/
camera.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import cv2 as cv
class PongGame:
def draw_left_slider(self, frame):
cv.rectangle(frame, (0,0), (frame.shape[0], frame.shape[1]),(255,0,0), 3)
def draw_right_slider(self,frame):
cv.rectangle(frame,(),(frame.shape[0], frame.shape[1]), (0, 0, 255), 3)
# press SPACE to take picture, ESC to quit
def take_a_photo():
# auf Patricia's Laptop 1 ist logitech-webcam
cam = cv.VideoCapture(0)
img_counter = 0
while True:
ret, frame = cam.read()
cv.rectangle(frame,(384,0),(510,128),(0,255,0),3)
cv.imshow("before", frame)
# cv.imshow("edge", edge)
if not ret:
break
k = cv.waitKey(1)
if k % 256 == 27:
# ESC pressed
print("Escape hit, closing...")
break
cam.release()
cv.destroyAllWindows()
take_a_photo()