Ask Your Question

picamera alternative in openCV(C++)

asked 2017-03-16 05:14:33 -0600

hyder gravatar image


There is a python package available for controlling Raspberry Pi camera called picamera which exposes all the options available in raspistill.

I need to access/change the "sensor mode" (which changes the resolution) for capturing. I am using openCV (C++) for my application but there is no option to change "sensor mode" available in cv::VideoCapture::set. There is a field of CV_CAP_PROP_MODE but that is not the same. So my question is:

  1. Is there a way to change the "sensor mode" in openCV?

  2. If not, then is there a C++ alternative available like picamera?

  3. If not, then is there a way to use this python package in my C++ program?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-03-16 05:32:59 -0600

berak gravatar image
  1. regardless, if the pi folks call it "sensor mode", using videocapture you would set CAP_PROP_FRAME_HEIGHT and CAP_PROP_FRAME_WIDTH to set the resolution

  2. no idea

  3. no, you cannot use python packages from c++

edit flag offensive delete link more


  1. That is what I thought; sensor mode is essentially changing capturing resolution so I used CAP_PROP_FRAME_WIDTH and CAP_PROP_FRAME_HEIGHT but it only changes the resolution and not the sensor mode. This is confirmed by the fact that if the sensor mode had been changed successfully to "mode 5" (corresponding to 1296x730), my output image would not contain any "junk" value.

  2. Wouldn't using boost::python help?

Any other suggestion?

hyder gravatar imagehyder ( 2017-03-16 06:50:24 -0600 )edit

Question Tools

1 follower


Asked: 2017-03-16 05:14:33 -0600

Seen: 1,076 times

Last updated: Mar 16 '17