diff --git a/README.md b/README.md
index a062684..714e382 100644
--- a/README.md
+++ b/README.md
@@ -18,5 +18,7 @@
- https://www.tutorialspoint.com/flask
### Qr Code reading
+- https://circuitdigest.com/microcontroller-projects/qr-code-scanner-using-raspberry-pi-and-opencv
-- https://circuitdigest.com/microcontroller-projects/qr-code-scanner-using-raspberry-pi-and-opencv
\ No newline at end of file
+### Camera stream to flask webpage
+- https://github.com/itsachrafmansari/flask_camera_stream
\ No newline at end of file
diff --git a/camera_test.py b/camera_test.py
index db376b7..f5ecf61 100644
--- a/camera_test.py
+++ b/camera_test.py
@@ -37,7 +37,7 @@ while True:
barcodeData))
csv.flush()
found.add(barcodeData)
- cv2.imshow("Barcode Reader", frame)
+# cv2.imshow("Barcode Reader", frame)
key = cv2.waitKey(1) & 0xFF
# if the `s` key is pressed, break from the loop
diff --git a/website/app.py b/website/app.py
index 66af71f..378601c 100644
--- a/website/app.py
+++ b/website/app.py
@@ -1,10 +1,23 @@
-from flask import Flask, render_template
+from flask import Flask, render_template, Response
+import cv2
app = Flask(__name__)
+def stream(camera_index):
+ cam = cv2.VideoCapture(camera_index)
+ while True:
+ _, frame = cam.read()
+ ret, jpg = cv2.imencode('.jpg', frame)
+ jpg2bytes = jpg.tobytes()
+ yield b'--frame\r\nContent-Type: image/jpeg\r\n\r\n' + jpg2bytes + b'\r\n\r\n'
+
@app.route('/')
def index():
- return render_template(index.html)
+ return render_template('index.html')
+
+@app.route('/stream_feed')
+def stream_fedd():
+ return Response(stream(0), mimetype='multipart/x-mixed-replace; boundary=frame')
if __name__ == '__main__':
app.run(debug=True, port=5000, host='0.0.0.0')
diff --git a/website/template/index.html b/website/template/index.html
deleted file mode 100644
index 626516a..0000000
--- a/website/template/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/website/templates/index.html b/website/templates/index.html
new file mode 100644
index 0000000..2985d45
--- /dev/null
+++ b/website/templates/index.html
@@ -0,0 +1,17 @@
+
+
+
+