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
21 changes: 21 additions & 0 deletions computer_vision/upload_video_cv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#this script helps load video into colab environment. You should be asked to upload video.
#recommend to seperate code into cells for testing purposes.
import cv2
from google.colab import files
from google.colab.patches import cv2_imshow

# Uploading the video
uploaded = files.upload()
your_video = list(uploaded.keys())[0]

# 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)

if not video.isOpened():
print("Error opening video file")
else:
print("Video successfully loaded and ready")