Image quality low with OpenCV

Hello there!

I’m having a lot of trouble using the build-in VideoCapture(0), because the quality of the images OpenCV produces is a lot worse than raspistill. I’ve also tried using the RaspiCam library (0.1.9)
OpenCV VideoCapture with read() (Only one of several tries, see below):


The raspicam_cv_test from RaspiCam (No parameters):

Raspistill (No parameters, only -o for output):

(Only one embedded media and missing links as this is the limit for new users, sorry. :confused:)

I have been using OpenCV 4.2 in C++ on the Raspberry Pi 4. Furthermore, I have already tried several recommended approaches:

  • Letting the camera run for several seconds
  • Making 5-20 images instead of just 1 (every image had roughly the same quality)
  • Changing a few attributes of the Videocapture: CAP_PROP_XI_FRAMERATE, CAP_PROP_FRAME_WIDTH, CAP_PROP_FRAME_HEIGHT, CAP_PROP_AUTO_EXPOSURE.

I would be extremely grateful for any answers, please let me know if additional information would help.

the trick is to add them all up, and fake a long EXPOSURE TIME.

a STILL image can use almost arbitrary exposure times. OpenCV would read VIDEO frames from the camera, which have exposures of at most (1 second / frame rate).

I’d recommend specific code (there’s a python library?) for the raspberry pi camera that makes use of particular still image capture methods.

that will do nothing except let any auto exposure setting settle, which usually happens within a split second.