0

I am using pi camera v1 (5 MP) on raspberry pi3 with v4l2 driver. When I use the commands below, it captures 5 MP image but I can't get the same image when I capture it from OpenCV. Captured image from OpenCV is always 480x480.

sudo modprobe bcm2835-v4l2 max_video_width=2592 max_video_height=1944
v4l2-ctl --set-fmt-video=width=2592,height=1944,pixelformat=MJPG
v4l2-ctl -p 15
v4l2-ctl --stream-mmap=3 --stream-count=1 --stream-to=somefile.mjpeg

What can I do to change the resolution to 5 MP in OpenCV ?

DIF
  • 2,470
  • 6
  • 35
  • 49

1 Answers1

0

I am not sure what you have tried, but one way to specify the resolution is:

cv::VideoCapture cap;
cap.set(CV_CAP_PROP_FRAME_WIDTH, 2592);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 1944);
Julian
  • 909
  • 8
  • 21
  • I was exactly trying the same way and using qt creator as editor. This code did not work (didn't change the resolution) when I run the code from the terminal, but it worked when I run it directly from qt creator program. – Eray Varyeter Feb 28 '18 at 19:19