Upload 2 files
Browse files- requirements.txt +2 -1
- streamlit_app.py +26 -0
requirements.txt
CHANGED
@@ -1 +1,2 @@
|
|
1 |
-
streamlit
|
|
|
|
1 |
+
streamlit-camera-input-live
|
2 |
+
opencv-python-headless
|
streamlit_app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2
|
2 |
+
import numpy as np
|
3 |
+
import streamlit as st
|
4 |
+
|
5 |
+
from camera_input_live import camera_input_live
|
6 |
+
|
7 |
+
"# Streamlit camera input live Demo"
|
8 |
+
"## Try holding a qr code in front of your webcam"
|
9 |
+
|
10 |
+
image = camera_input_live()
|
11 |
+
|
12 |
+
if image is not None:
|
13 |
+
st.image(image)
|
14 |
+
bytes_data = image.getvalue()
|
15 |
+
cv2_img = cv2.imdecode(np.frombuffer(bytes_data, np.uint8), cv2.IMREAD_COLOR)
|
16 |
+
|
17 |
+
detector = cv2.QRCodeDetector()
|
18 |
+
|
19 |
+
data, bbox, straight_qrcode = detector.detectAndDecode(cv2_img)
|
20 |
+
|
21 |
+
if data:
|
22 |
+
st.write("# Found QR code")
|
23 |
+
st.write(data)
|
24 |
+
with st.expander("Show details"):
|
25 |
+
st.write("BBox:", bbox)
|
26 |
+
st.write("Straight QR code:", straight_qrcode)
|