I have been working with my Raspberry Pi 2B for a while now. Testing the Pi cam using raspistill
works great but trying to use OpenCV functions such as VideoCapture.open();
won't work. trying the same command with a USB camera works just fine. I tried different indexes as inputs but nothing works for the pi cam. What am I missing here?
sudo modprobe bcm2835-v4l2
will "enable" the camera for opencv automatically.
make sure you have the camera enabled from the raspberry config, either gui or raspi-config. the above loads the necessary drivers to handle everything automatically, i.e. loads the appropriate interfaces (v4l2 drivers) for the raspberry camera.
works out of the box on raspbian jessie. other releases might include the drivers by default, but the link below contains info on compiling the drivers in your worst case. so you should be able to get this to work with pidora as well.
more info: https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=62364