microsoft / microsoft/WSL

OpenCV cannot find camera device in wsl2

Open
#6,211 22 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

I run opencv python file to open camera in wsl2 ubuntu. But it cannot open camera device first.
Then, i changed the code from
cap = cv2.VideoCapture(0)
to
cap = cv2.VideoCapture(-1)
Still facing issue the message show cannot find camera device.
So, I think wsl2 ubuntu doesn't support webcam access.
Not sure it is a bug or feature for wsl2 ubuntu.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in WSL2 Ubuntu with the OpenCV Python calls shown in the report: cv2.VideoCapture(0) and cv2.VideoCapture(-1). Investigate whether WSL2 exposes webcam devices and whether this is an unsupported capability or an implementation gap. Done means establishing the supported behavior and, if feasible, adding webcam access or documenting the limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, python, ubuntu
Domain
computer-vision, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.