def generate_frames():
capture = cv2.VideoCapture(-1)
while True:
bollean , frame = capture.read()
ret , buffer = cv2.imencode('.jpg',frame)
frame = buffer.tobytes()
yield (b'--frame
'
b'Content-Type: image/jpeg
' + frame + b'
')
@app.route('/video_feed')
def video_feed():
return Response(generate_frames(), mimetype='multipart/x-mixed-replace; boundary=frame')