-
Notifications
You must be signed in to change notification settings - Fork 0
/
camera.py
executable file
·58 lines (40 loc) · 1.08 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from picamera import PiCamera
from time import sleep
import csv
from testpolly import make_audio
camera = PiCamera()
camera.start_preview()
sleep(5)
camera.capture('/home/pi/Desktop/image.jpg')
camera.stop_preview()
import boto3
s3= boto3.client('s3')
s3.upload_file("/home/pi/Desktop/image.jpg","bonbon10", "image.jpg")
client = boto3.client('rekognition')
response = client.detect_labels(
Image={
'S3Object':{
'Bucket': 'bonbon10',
'Name': 'image.jpg'
}
}
)
#Import things to filter
#fileThings = open("/home/pi/Desktop/things.csv")
#thingData = csv.reader(fileThings)
#print(thingData)
#Find all the things in the picture
things = []
for d in response['Labels']:
if (d['Confidence'] > 80):
things.append((d['Confidence'],d['Name']))
#Sort all the in terms of accuracy
things.sort(reverse = True)
if len(things) >= 2:
print("Two things with highest accuracy: ")
print(things[0][1],things[1][1])
elif len(things) == 1:
print(things[0][1])
else:
print("nothing detected!")
make_audio('fdsfsfsdfsdfsdf')