Skip to content

Update and rename __init__.py to video_upload_and_cvprep.py #12005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
Empty file removed computer_vision/__init__.py
Empty file.
22 changes: 22 additions & 0 deletions computer_vision/video_upload_and_cvprep.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Uploading video to colab for object detection

Check failure on line 1 in computer_vision/video_upload_and_cvprep.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (INP001)

computer_vision/video_upload_and_cvprep.py:1:1: INP001 File `computer_vision/video_upload_and_cvprep.py` is part of an implicit namespace package. Add an `__init__.py`.

Check failure on line 1 in computer_vision/video_upload_and_cvprep.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (INP001)

computer_vision/video_upload_and_cvprep.py:1:1: INP001 File `computer_vision/video_upload_and_cvprep.py` is part of an implicit namespace package. Add an `__init__.py`.
import cv2
from google.colab import files
from google.colab.patches import cv2_imshow

Check failure on line 4 in computer_vision/video_upload_and_cvprep.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

computer_vision/video_upload_and_cvprep.py:4:34: F401 `google.colab.patches.cv2_imshow` imported but unused

Check failure on line 4 in computer_vision/video_upload_and_cvprep.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

computer_vision/video_upload_and_cvprep.py:4:34: F401 `google.colab.patches.cv2_imshow` imported but unused

uploaded = files.upload()

yourvideo = list(uploaded.keys())[0]
# once run, you will be promoted to select the video for object detection.

# next cell, I like to break my code up so I can check for errors
with open(yourvide, "wb") as f:
f.write(
uploaded[yourvideo]
) # this write it to a file in Colab's runtime temporary file system

# preparing video for CV2 library
video = cv2.VideoCapture(yourvideo)
if not video.isOpened():
print("Error opening video file")
else:
print("Video successfully loaded and ready")
Loading