-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapplication.py
More file actions
88 lines (68 loc) · 2.04 KB
/
application.py
File metadata and controls
88 lines (68 loc) · 2.04 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from flask import Flask, render_template, request, Response, redirect, url_for
from flask_bootstrap import Bootstrap
from object_detection import *
from camera_settings import *
application = Flask(__name__)
Bootstrap(application)
application.config['BOOTSTRAP_BTN_STYLE'] = 'primary'
check_settings()
VIDEO = VideoStreaming()
@application.route('/')
def home():
return render_template('index.html')
@application.route('/video_feed')
def video_feed():
'''
Video streaming route.
'''
return Response(
VIDEO.show(),
mimetype='multipart/x-mixed-replace; boundary=frame'
)
# Button requests called from ajax
@application.route('/request_preview_switch')
def request_preview_switch():
VIDEO.preview = not VIDEO.preview
print('*'*10, VIDEO.preview)
return "nothing"
@application.route('/request_flipH_switch')
def request_flipH_switch():
VIDEO.flipH = not VIDEO.flipH
print('*'*10, VIDEO.flipH)
return "nothing"
@application.route('/request_model_switch')
def request_model_switch():
VIDEO.detect = not VIDEO.detect
print('*'*10, VIDEO.detect)
return "nothing"
@application.route('/request_exposure_down')
def request_exposure_down():
VIDEO.exposure -= 1
print('*'*10, VIDEO.exposure)
return "nothing"
@application.route('/request_exposure_up')
def request_exposure_up():
VIDEO.exposure += 1
print('*'*10, VIDEO.exposure)
return "nothing"
@application.route('/request_contrast_down')
def request_contrast_down():
VIDEO.contrast -= 4
print('*'*10, VIDEO.contrast)
return "nothing"
@application.route('/request_contrast_up')
def request_contrast_up():
VIDEO.contrast += 4
print('*'*10, VIDEO.contrast)
return "nothing"
@application.route('/reset_camera')
def reset_camera():
STATUS = reset_settings()
VIDEO.contrast = 0.0
VIDEO.exposure = 156.0
print('*'*10, STATUS)
return "nothing"
# if __name__ == '__main__':
# application.run(debug=True)
if __name__ == '__main__':
application.run(host ='0.0.0.0', port = 5001, debug=False)