Update application
This commit is contained in:
@ -1,17 +1,72 @@
|
|||||||
from flask import Flask, render_template, request
|
from flask import Flask, render_template, request, Response, redirect, url_for
|
||||||
from flask_bootstrap import Bootstrap
|
from flask_bootstrap import Bootstrap
|
||||||
|
|
||||||
|
from object_detection import *
|
||||||
|
from camera_settings import *
|
||||||
|
|
||||||
|
|
||||||
application = Flask(__name__)
|
application = Flask(__name__)
|
||||||
Bootstrap(application)
|
Bootstrap(application)
|
||||||
|
|
||||||
|
|
||||||
|
check_settings()
|
||||||
|
VIDEO = VideoStreaming()
|
||||||
|
|
||||||
|
|
||||||
@application.route('/')
|
@application.route('/')
|
||||||
@application.route('/index.html')
|
|
||||||
def home():
|
def home():
|
||||||
TITLE = 'Object detection'
|
TITLE = 'Object detection'
|
||||||
return render_template('index.html', TITLE=TITLE)
|
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 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_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"
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
application.run(debug=True)
|
application.run(debug=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user