I want to connect to the webcam from WSL(ubuntu)

Asked 2 years ago, Updated 2 years ago, 174 views

I would like to do real-time object detection using YOLOv3 webcam on ubuntu for windows.
I came to the point where OpenCV works while looking at various sites, but when I was actually running YOLOv3, I got the following error:

cv2.VideoCapture(0)
>>VIDEOIO ERROR:V4L:can't open camera by index 0

As far as I've looked into it, it seems that the only way to resolve this error is to link the webcam that can be used to dev/video0 but I don't know how to do that.
Does anyone know anything?
Also, if you know how to connect to the webcam on WSL, I would appreciate it if you could tell me how to do so.

Reference Site:
Linux:Get information about available webcams
VIDEOIO ERROR:V4L:can't find camera device

ubuntu opencv windows-10 wsl

2022-09-30 21:44

1 Answers

WSL, which can be used in current standards, does not seem to support it yet.

/dev/video0 Camera support on WSL?

Is there any way to pass the camera through to Windows Subsystem for Linux? This feature would make everything I'm doing right now so much asier.I know there is a feature request for USB support, but there a workaround for now?Can I setup a camera stream on my host and access the 'networked' stream on the Ubuntu terminal?

Is there a way to pass the camera to Linux's Windows Subsystem?This feature makes everything I'm doing very easy.I know there is a feature request for USB support, but is there a workaround so far?Can I set up a camera stream on the host and access the "network" stream on the Ubuntu terminal?

Alas, no, WSL does not support camera devices at this time. If this is something you'd like to see in future releases, please find & upgrade or file an ask on the WSL UserVoice page.

Unfortunately, WSL does not support camera devices at this time. If this is what you want to see in a future release, find the questions on the WSL UserVoice page and vote or submit your questions.

When I search the current repository, nothing comes up.
We couldn't find any code matching'camera' in Microsoft/WSL
We couldn't find any code matching 'video' in Microsoft/WSL

However, WSL2, which should appear in the future, seems to support many things.
If you search the repository, you'll see a lot of them.
Search-camera 770 code results in Microsoft/WSL2-Linux-Kernel
Search-video 3,283 code results in Microsoft/WSL2-Linux-Kernel

If Windows for pre-testing and running WSL2 are available in the Windows Insider program, you may be able to use it.


2022-09-30 21:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.