i am trying to run this face recognition code from here!

i successfully installed OpenCV on the raspberry, and i used the code before on windows.

but here i have the problem with the raspberry camera module device ID, i tried the values 0-9 values for the ID , The Capture Device ID 0 cannot be opened. is all i get.

any help would be great. thank you

  • Have you enabled support for the camera module in raspi-config? Commented Apr 8, 2016 at 19:07
  • 1
    yes i did , i run the line "sudo modprobe bcm2835-v4l2" as in the first answer and it worked , thank you anyways :) Commented Apr 8, 2016 at 21:02

1 Answer 1



make sure you enable the camera module in raspi-config as Android Dev has suggested.

But also, in my experience, you need to run this in cmd line before the Raspi Camera can be used:

sudo modprobe bcm2835-v4l2

Run that line in cmd line and then try your application again. :)

  • it worked !!! :D that is awesome !! thank you very much , i have no idea how or why , but for that i thank you , been searching for hours now Commented Apr 8, 2016 at 21:00
  • Any time. I too am working on an OpenCV project using the RPi & it's camera. Took me a while to find this answer myself. :)
    – Myg0t
    Commented Apr 9, 2016 at 17:59
  • can i ask you something . i think you to faced the long delay and small fps i assume , did you overcome that ? and how ? thank you again :D Commented Apr 10, 2016 at 16:10
  • Are you trying to view the video live? I did face low FPS when I was streaming the video. If you record the video to a file and then view the file your FPS should be fine.
    – Myg0t
    Commented Apr 12, 2016 at 16:15
  • Actually I want it in real time , I am thinking the reason for the delay is the v4l2 because it runs on the processor unlike raspivid which runs on the GPU !! I am trying to stream a video into opencv ! Any thoughts ?! Thank you for your time Commented Apr 12, 2016 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.