I tried making this code work with the raspberry pi cam.
how do you make the cv2.VideoCapture(0) recognise the raspberry pi camera as the designated camera
Some time ago, I developed on a rasperry pi with raspicam, an interface for opencv.
I thought that the video capture in pure cv only works for usb devices
You can download raspicam under
http://sourceforge.net/projects/raspicam/files/