Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions computer_vision/video_cv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import cv2
from google.colab import files
from google.colab.patches import cv2_imshow

Check failure on line 3 in computer_vision/video_cv.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

computer_vision/video_cv.py:3:34: F401 `google.colab.patches.cv2_imshow` imported but unused
# Uploading the video

Check failure on line 4 in computer_vision/video_cv.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

computer_vision/video_cv.py:1:1: I001 Import block is un-sorted or un-formatted
uploaded = files.upload()
your_video = list(uploaded.keys())[0]

Check failure on line 6 in computer_vision/video_cv.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (RUF015)

computer_vision/video_cv.py:6:14: RUF015 Prefer `next(iter(uploaded.keys()))` over single element slice
# Save the uploaded file to Colab's runtime temporary file system
with open(your_video, 'wb') as f:
f.write(uploaded[your_video])
# Preparing video for CV2 library
video = cv2.VideoCapture(your_video)
#building in if else statement
if not video.isOpened():
print("Error opening video file")
else:
print("Video successfully loaded and ready")
Loading