Solution for Raspberry Pi VIDEOIO ERROR: V4L

I tried -1, 0, 1 as argument for the VideoCapture function, but none of them worked, then what’s the problem?

Error page

Firstly, use

$ raspi-config

and then go to Interfacing Options, choose Camera, make sure that the camera is enabled.

If it does not work, use the following command, which is commonly work.

$ sudo modprobe bcm2835-v4l2