PBJ commited on
Commit
feb9721
β€’
1 Parent(s): c7c7506

Update pages/2_πŸ“·_Webcamera.py

Browse files
Files changed (1) hide show
  1. pages/2_πŸ“·_Webcamera.py +29 -26
pages/2_πŸ“·_Webcamera.py CHANGED
@@ -1,33 +1,33 @@
1
- # import streamlit as st
2
- # from streamlit_webrtc import webrtc_streamer
3
- # import av
4
- # import cv2
5
- # import time
6
- # import mediapipe as mp
7
- # import numpy as np
8
- # import pandas as pd
9
- # from mediapipe_functions import *
10
- # from utils import *
11
- # import tensorflow as tf
12
 
13
  # st.title("Webcamera")
14
  # st.write("Steps to use: \n1. Click on Start button.\n2. To stop the video when done, press Stop. \n\n The output will be displayed in about 40 secs.")
15
 
16
- # class VideoProcessor:
17
- # def __init__(self) -> None:
18
- # self.threshold1 = 100
19
- # self.threshold2 = 200
20
- # self.my_list = []
21
 
22
- # def recv(self, frame):
23
- # img = frame.to_ndarray(format="bgr24")
24
- # self.my_list.append(img)
25
- # return av.VideoFrame.from_ndarray(img, format="bgr24")
26
 
27
- # # Create the video processor instance
28
- # video_processor = VideoProcessor()
29
 
30
- # ctx = webrtc_streamer(key="sample", video_processor_factory=lambda: video_processor)
31
 
32
  # time.sleep(10)
33
  # st.write(len(ctx.video_processor.my_list))
@@ -66,8 +66,11 @@
66
  # output_df.rename(columns = {0:'Index'}, inplace = True)
67
  # st.write(output_df)
68
  import streamlit as st
 
69
 
70
- picture = st.camera_input("Take a picture")
 
 
71
 
72
- if picture:
73
- st.image(picture)
 
1
+ import streamlit as st
2
+ from streamlit_webrtc import webrtc_streamer
3
+ import av
4
+ import cv2
5
+ import time
6
+ import mediapipe as mp
7
+ import numpy as np
8
+ import pandas as pd
9
+ from mediapipe_functions import *
10
+ from utils import *
11
+ import tensorflow as tf
12
 
13
  # st.title("Webcamera")
14
  # st.write("Steps to use: \n1. Click on Start button.\n2. To stop the video when done, press Stop. \n\n The output will be displayed in about 40 secs.")
15
 
16
+ class VideoProcessor:
17
+ def __init__(self) -> None:
18
+ self.threshold1 = 100
19
+ self.threshold2 = 200
20
+ self.my_list = []
21
 
22
+ def recv(self, frame):
23
+ img = frame.to_ndarray(format="bgr24")
24
+ self.my_list.append(img)
25
+ return av.VideoFrame.from_ndarray(img, format="bgr24")
26
 
27
+ # Create the video processor instance
28
+ video_processor = VideoProcessor()
29
 
30
+ ctx = webrtc_streamer(key="sample", video_processor_factory=lambda: video_processor)
31
 
32
  # time.sleep(10)
33
  # st.write(len(ctx.video_processor.my_list))
 
66
  # output_df.rename(columns = {0:'Index'}, inplace = True)
67
  # st.write(output_df)
68
  import streamlit as st
69
+ import time
70
 
71
+ # start = time.time()
72
+ # while(time.)
73
+ # picture = st.camera_input("Take a picture")
74
 
75
+ # if picture:
76
+ # st.image(picture)