awacke1 commited on
Commit
43097e0
1 Parent(s): d0ed8ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -2
app.py CHANGED
@@ -2,7 +2,34 @@ import streamlit as st
2
 
3
  from camera_input_live import camera_input_live
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  image = camera_input_live()
6
 
7
- if image:
8
- st.image(image)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  from camera_input_live import camera_input_live
4
 
5
+ #image = camera_input_live()
6
+
7
+ #if image:
8
+ # st.image(image)
9
+
10
+ import cv2
11
+ import numpy as np
12
+ import streamlit as st
13
+ from camera_input_live import camera_input_live
14
+
15
+ "# Streamlit camera input live Demo"
16
+ "## Try holding a qr code in front of your webcam"
17
+
18
  image = camera_input_live()
19
 
20
+ if image is not None:
21
+ st.image(image)
22
+ bytes_data = image.getvalue()
23
+ cv2_img = cv2.imdecode(np.frombuffer(bytes_data, np.uint8), cv2.IMREAD_COLOR)
24
+
25
+ detector = cv2.QRCodeDetector()
26
+
27
+ data, bbox, straight_qrcode = detector.detectAndDecode(cv2_img)
28
+
29
+ if data:
30
+ st.write("# Found QR code")
31
+ st.write(data)
32
+ with st.expander("Show details"):
33
+ st.write("BBox:", bbox)
34
+ st.write("Straight QR code:", straight_qrcode)
35
+