Update pages/How to handle Videos.py
Browse files
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(
|
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(
|
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 |
|