Skip to content
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

can't open camera by index in Colab #97

Open
isinsuarici opened this issue Aug 18, 2022 · 1 comment
Open

can't open camera by index in Colab #97

isinsuarici opened this issue Aug 18, 2022 · 1 comment

Comments

@isinsuarici
Copy link

I'm using colab and when I run the following code:

!python detect_video.py --weights ./checkpoints/yolov4-416 --size 416 --model yolov4 --video 0 --output ./detections/results2.avi --crop

then it says:

[ WARN:[email protected]] global /io/opencv/modules/videoio/src/cap_v4l.cpp (902) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
Video has ended or failed, try a different video format!

I know the problem is with opening the camera in Colab. But I couldn't find how to solve it.

@isinsuarici
Copy link
Author

I know it's about the part:

try:
    vid = cv2.VideoCapture(int(video_path))
except:
    vid = cv2.VideoCapture(video_path)

When I wrote --video 0, it looks for a camera but Colab doesn't have a camera. I have to connect to my local camera. But how can I do that? ( I saw the snippets about Javascript but I can't use it in this way.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant