thinh-huynh-re commited on
Commit
0885c5d
1 Parent(s): 68f1278
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -151,3 +151,18 @@ if uploadedfile is not None:
151
  st.info(f"{end_time - start_time} seconds")
152
  st.dataframe(df)
153
  st.video(VIDEO_TMP_PATH)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  st.info(f"{end_time - start_time} seconds")
152
  st.dataframe(df)
153
  st.video(VIDEO_TMP_PATH)
154
+
155
+ img_file_buffer = st.camera_input("Take a picture")
156
+
157
+ if img_file_buffer is not None:
158
+ # To read image file buffer with OpenCV:
159
+ bytes_data = img_file_buffer.getvalue()
160
+ cv2_img = cv2.imdecode(np.frombuffer(bytes_data, np.uint8), cv2.IMREAD_COLOR)
161
+
162
+ # Check the type of cv2_img:
163
+ # Should output: <class 'numpy.ndarray'>
164
+ st.write(type(cv2_img))
165
+
166
+ # Check the shape of cv2_img:
167
+ # Should output shape: (height, width, channels)
168
+ st.write(cv2_img.shape)