Update README.md
Browse files
README.md
CHANGED
|
@@ -76,6 +76,35 @@ file_path = hf_hub_download(
|
|
| 76 |
)
|
| 77 |
```
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
## Cite us in your work
|
| 80 |
```
|
| 81 |
@misc{gupta2024vidasvisionbaseddangerassessment,
|
|
|
|
| 76 |
)
|
| 77 |
```
|
| 78 |
|
| 79 |
+
Use OpenCV to load the video and display
|
| 80 |
+
```
|
| 81 |
+
import cv2
|
| 82 |
+
|
| 83 |
+
# Load the video file using OpenCV
|
| 84 |
+
cap = cv2.VideoCapture(file_path)
|
| 85 |
+
|
| 86 |
+
# Check if the video was successfully opened
|
| 87 |
+
if not cap.isOpened():
|
| 88 |
+
print("Error: Could not open video.")
|
| 89 |
+
exit()
|
| 90 |
+
|
| 91 |
+
# Read and display video frames
|
| 92 |
+
while True:
|
| 93 |
+
ret, frame = cap.read()
|
| 94 |
+
if not ret:
|
| 95 |
+
break
|
| 96 |
+
|
| 97 |
+
cv2.imshow('Video', frame)
|
| 98 |
+
|
| 99 |
+
# Press 'q' to exit the video window
|
| 100 |
+
if cv2.waitKey(25) & 0xFF == ord('q'):
|
| 101 |
+
break
|
| 102 |
+
|
| 103 |
+
# Release video capture and close windows
|
| 104 |
+
cap.release()
|
| 105 |
+
cv2.destroyAllWindows()
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
## Cite us in your work
|
| 109 |
```
|
| 110 |
@misc{gupta2024vidasvisionbaseddangerassessment,
|