File size: 526 Bytes
5a5a9b5
e946a46
5a5a9b5
688bf35
5a5a9b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import cv2
import streamlit as st

cap = cv2.VideoCapture(2)

st.title("Sign Language App")

frame_placeholder = st.empty()

stop_button_pressed = st.button("Stop")
while cap.isOpened() and not stop_button_pressed:
    ret, frame = cap.read()

    if not ret:
        st.write('video ended')
        break
    frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
    frame_placeholder.image(frame, channels='RGB')
    if cv2.waitKey(1) & 0xFF == ord('q') or stop_button_pressed:
        break

cap.release()
cv2.destroyAllWindows()