Skip to content

Commit

Permalink
Add example app
Browse files Browse the repository at this point in the history
  • Loading branch information
blackary committed Sep 27, 2022
1 parent 4fffb93 commit 48a0e5a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions example_app/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
streamlit-camera-input-live
opencv-python-headless
25 changes: 25 additions & 0 deletions example_app/streamlit_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import cv2
import numpy as np
import streamlit as st
from camera_input_live import camera_input_live

"# Streamlit camera input live Demo"
"## Try holding a qr code in front of your webcam"

image = camera_input_live()

if image is not None:
st.image(image)
bytes_data = image.getvalue()
cv2_img = cv2.imdecode(np.frombuffer(bytes_data, np.uint8), cv2.IMREAD_COLOR)

detector = cv2.QRCodeDetector()

data, bbox, straight_qrcode = detector.detectAndDecode(cv2_img)

if data:
st.write("# Found QR code")
st.write(data)
with st.expander("Show details"):
st.write("BBox:", bbox)
st.write("Straight QR code:", straight_qrcode)

0 comments on commit 48a0e5a

Please sign in to comment.