Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV On Raspberry Pi2: Camera Resolution

Hi Folks, I asked this question a few days ago on the Raspberry Pi forums but have yet to receive a reply so I am hoping that there might be more expertise on the OpenCV forums to help.

I recently compiled/installed opencv 3.1 on my RPi2 and it works just fine. I had to do a bit of searching to find out how to activate the pi camera to get OpenCV to see it (by basically entering "sudo modprobe bcm2835-v4l2" into the terminal) but the only limitation I now have is that OpenCV commands to modify the camera resolution do not work. The camera is works perfectly fine with OpenCV but the resolution remains fixed at 640x480 despite attempts to change it with OpenCV code (the resolution can not be increased or even decreased).

For example:

std::cout<<cap.get(cv::CAP_PROP_FRAME_WIDTH)<<std::endl; //output: 640
cap.set(cv::CAP_PROP_FRAME_WIDTH, 1080); //does not work
std::cout<<cap.get(cv::CAP_PROP_FRAME_WIDTH)<<std::endl; //output is still 640

Does anyone know how to get the camera/V4L driver to respond to OpenCV calls to change the camera resolution? The camera has a "CSi" interface and can be viewed on Amazon: http://www.amazon.com/Raspberry-5MP-Camera-Board-Module/dp/B00E1GGE40

Thanks, Djme.