Update project with minor fixes and improvements

This commit is contained in:
Diego Inácio
2022-06-24 14:53:57 -03:00
parent 7cb96779e4
commit 478e3d8837
5 changed files with 110 additions and 91 deletions

View File

@ -13,72 +13,79 @@ check_settings()
VIDEO = VideoStreaming()
@application.route('/')
@application.route("/")
def home():
TITLE = 'Object detection'
return render_template('index.html', TITLE=TITLE)
TITLE = "Object detection"
return render_template("index.html", TITLE=TITLE)
@application.route('/video_feed')
@application.route("/video_feed")
def video_feed():
'''
"""
Video streaming route.
'''
"""
return Response(
VIDEO.show(),
mimetype='multipart/x-mixed-replace; boundary=frame'
mimetype="multipart/x-mixed-replace; boundary=frame"
)
# Button requests called from ajax
@application.route('/request_preview_switch')
# * Button requests
@application.route("/request_preview_switch")
def request_preview_switch():
VIDEO.preview = not VIDEO.preview
print('*'*10, VIDEO.preview)
print("*"*10, VIDEO.preview)
return "nothing"
@application.route('/request_flipH_switch')
@application.route("/request_flipH_switch")
def request_flipH_switch():
VIDEO.flipH = not VIDEO.flipH
print('*'*10, VIDEO.flipH)
print("*"*10, VIDEO.flipH)
return "nothing"
@application.route('/request_model_switch')
@application.route("/request_model_switch")
def request_model_switch():
VIDEO.detect = not VIDEO.detect
print('*'*10, VIDEO.detect)
print("*"*10, VIDEO.detect)
return "nothing"
@application.route('/request_exposure_down')
@application.route("/request_exposure_down")
def request_exposure_down():
VIDEO.exposure -= 1
print('*'*10, VIDEO.exposure)
print("*"*10, VIDEO.exposure)
return "nothing"
@application.route('/request_exposure_up')
@application.route("/request_exposure_up")
def request_exposure_up():
VIDEO.exposure += 1
print('*'*10, VIDEO.exposure)
print("*"*10, VIDEO.exposure)
return "nothing"
@application.route('/request_contrast_down')
@application.route("/request_contrast_down")
def request_contrast_down():
VIDEO.contrast -= 4
print('*'*10, VIDEO.contrast)
print("*"*10, VIDEO.contrast)
return "nothing"
@application.route('/request_contrast_up')
@application.route("/request_contrast_up")
def request_contrast_up():
VIDEO.contrast += 4
print('*'*10, VIDEO.contrast)
print("*"*10, VIDEO.contrast)
return "nothing"
@application.route('/reset_camera')
@application.route("/reset_camera")
def reset_camera():
STATUS = reset_settings()
print('*'*10, STATUS)
print("*"*10, STATUS)
return "nothing"
if __name__ == '__main__':
if __name__ == "__main__":
application.run(debug=True)