Browse Source

make camera global

split-pipe
Hendrik Langer 4 years ago
parent
commit
3a8864ba1c
  1. 3
      raspberry/roberto/__init__.py
  2. 5
      raspberry/roberto/views/frontend/routes.py

3
raspberry/roberto/__init__.py

@ -12,7 +12,8 @@ from flask_login import LoginManager
# to the application at this point. # to the application at this point.
login = LoginManager() login = LoginManager()
login.login_view = "users.login" login.login_view = "users.login"
#from roberto.camera.camera_opencv import Camera from roberto.camera.camera_opencv import Camera
camera = Camera()
###################################### ######################################
#### Application Factory Function #### #### Application Factory Function ####

5
raspberry/roberto/views/frontend/routes.py

@ -22,6 +22,7 @@ def gen(camera):
@frontend_blueprint.route('/video_feed') @frontend_blueprint.route('/video_feed')
def video_feed(): def video_feed():
"""Video streaming route. Put this in the src attribute of an img tag.""" """Video streaming route. Put this in the src attribute of an img tag."""
from roberto.camera.camera_opencv import Camera from roberto import camera
return Response(gen(Camera()), camera.__init__()
return Response(gen(camera),
mimetype='multipart/x-mixed-replace; boundary=frame') mimetype='multipart/x-mixed-replace; boundary=frame')

Loading…
Cancel
Save