This repository has been archived by the owner on Jan 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathapplication.py
91 lines (64 loc) · 1.88 KB
/
application.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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)
check_settings()
VIDEO = VideoStreaming()
@application.route("/")
def home():
TITLE = "Object detection"
return render_template("index.html", TITLE=TITLE)
@application.route("/video_feed")
def video_feed():
"""
Video streaming route.
"""
return Response(
VIDEO.show(),
mimetype="multipart/x-mixed-replace; boundary=frame"
)
# * Button requests
@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()
print("*"*10, STATUS)
return "nothing"
if __name__ == "__main__":
application.run(debug=True)