Ask coding questions

← Back to all posts
Webcam not working
h
Nedia

[ WARN:0] global /tmp/pip-req-build-afu9cjzs/opencv/modules/videoio/src/cap_v4l.cpp (890) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
Traceback (most recent call last):
File "main.py", line 23, in <module>
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.5.3) /tmp/pip-req-build-afu9cjzs/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

Error pops up when running code, opencv package is installed.

Voters
Nedia
Comments
hotnewtop
CosmicBear

You can't open a camera on replit. Replit is a website, you can't use your camera on a virtual machine.

Nedia

@CosmicBear Ohh thanks