-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
66 lines (54 loc) · 1.54 KB
/
main.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
58
59
60
61
62
63
64
65
66
# import RPi.GPIO as GPIO
import time
import scene_descriptor
import picamera
import boot
import OCR
# import button1
# import button2
# import button3
# GPIO.setmode(GPIO.BCM)
# pin1 = 26
# pin2 = 23
# pin3 = 16
# GPIO.setup(pin1, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# GPIO.setup(pin2, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# GPIO.setup(pin3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# Instatiate camera
camera = picamera.PiCamera()
boot.detect_camera()
_key_DeepAI = 'aedb7e46-3664-494b-b30d-dfa5dff0429d'
key = '431346910fd7435180c72f27b72c5f8d'
scene_descriptor.bootstrap_MSC(key)
# try:
# True for getting button responses
# while True:
# print('Press a button')
# helper.output_audio('Press a button...')
# button_state1 = GPIO.input(pin1)
# button_state2 = GPIO.input(pin2)
# button_state3 = GPIO.input(pin3)
# if button_state1 == False:
print('Capture And Detect...')
helper.output_audio('Capture And Detect...')
# key = scene_descriptor.getKey()
try:
scene_descriptor.camera_PR(key, camera)
scene_descriptor.camera_PR_DeepAI(_key_DeepAI, camera)
except:
print "Some Unknown Error"
helper.output_audio("Some Unknown Error")
# if button_state2 == False:
print('OCR Activated...')
helper.output_audio('OCR Activated...')
# time.sleep(0.2)
imageName = r'./abc.jpg'
camera.capture(imageName)
print OCR.get_string('./' + imageName)
helper.output_audio('./' + imageName)
# if button_state3 == False:
print('Sending Emergency Message...')
helper.output_audio('Sending Emergency Message...')
time.sleep(0.2)
# except:
# GPIO.cleanup()