-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathtest.py
44 lines (34 loc) · 1.13 KB
/
test.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
35
36
37
38
39
40
41
42
43
44
import litecam
import time
camera_names = litecam.getDeviceList()
print(camera_names)
camera = litecam.PyCamera()
if camera.open(0):
print("Camera is opened")
mediaTypes = camera.listMediaTypes()
print(mediaTypes)
for i in range(3):
frame = camera.captureFrame()
if frame is not None:
width = frame[0]
height = frame[1]
size = frame[2]
data = frame[3]
filename = str(i) + ".jpg"
litecam.saveJpeg(filename, width, height, data)
time.sleep(1)
window = litecam.PyWindow(
camera.getWidth(), camera.getHeight(), "Camera Stream")
while window.waitKey('q'):
frame = camera.captureFrame()
if frame is not None:
width = frame[0]
height = frame[1]
size = frame[2]
data = frame[3]
window.showFrame(width, height, data)
contour_points = [(100, 100), (200, 100), (200, 200), (100, 200)]
window.drawContour(contour_points)
text = "Hello, World!"
window.drawText(text, 50, 50, 24, (255, 0, 0))
camera.release()