shwetashweta05 commited on
Commit
5f711c5
·
verified ·
1 Parent(s): 80b33fd

Update pages/How to handle Videos.py

Browse files
Files changed (1) hide show
  1. pages/How to handle Videos.py +2 -9
pages/How to handle Videos.py CHANGED
@@ -275,18 +275,11 @@ st.write("""
275
 
276
  st.write("**7. Clean Up Resources**")
277
  code="""
278
- cv2.destroyAllWindows() #Closes all OpenCV windows created by cv2.imshow().
279
- """
280
- st.code(code,language="python")
281
-
282
-
283
- st.write(":blue[**code**]")
284
- code="""
285
  import cv2
286
  import os
287
 
288
  # Create a directory to save images
289
- os.makedirs(r"C:\Users\Singh\Downloads\han_sign", exist_ok=True)
290
 
291
  # Initialize video capture
292
  vid = cv2.VideoCapture(0)
@@ -309,7 +302,7 @@ try:
309
 
310
  # Save the image when 's' key is pressed
311
  if cv2.waitKey(1) & 255 == ord("s"):
312
- cv2.imwrite(r"C:\Users\Singh\Downloads\han_sign\{}.jpg".format(c), img)
313
  print(f"Image {c} has been captured")
314
  c += 1
315
 
 
275
 
276
  st.write("**7. Clean Up Resources**")
277
  code="""
 
 
 
 
 
 
 
278
  import cv2
279
  import os
280
 
281
  # Create a directory to save images
282
+ os.makedirs("/home/user/han_sign", exist_ok=True)
283
 
284
  # Initialize video capture
285
  vid = cv2.VideoCapture(0)
 
302
 
303
  # Save the image when 's' key is pressed
304
  if cv2.waitKey(1) & 255 == ord("s"):
305
+ cv2.imwrite(f"/home/user/han_sign/{c}.jpg", img)
306
  print(f"Image {c} has been captured")
307
  c += 1
308