# Image quality low with OpenCV

**URL:** <https://forum.opencv.org/t/image-quality-low-with-opencv/2057>\
**Category:** C++\
**Tags:** videoio\
**Created:** [March 9, 2021, 7:18pm UTC](https://forum.opencv.org/t/image-quality-low-with-opencv/2057 "2021-03-09T19:18:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Werti](https://avatars.discourse-cdn.com/v4/letter/w/65b543/32.png) [@Werti](https://forum.opencv.org/u/Werti)\
**Post date:** [March 9, 2021, 7:18pm UTC](https://forum.opencv.org/t/image-quality-low-with-opencv/2057/1 "2021-03-09T19:18:05Z")

</div>

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):

 ![](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/8/8029f0ee2674c368580e0781489ec93e7daab17f.jpeg)  
The raspicam\_cv\_test from RaspiCam (No parameters):  
 ![](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/b/bb69bf70a75022e8c981f7df96eb5dcc01ae4a8b.jpeg)  
Raspistill (No parameters, only -o for output):  
 ![](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/f/f6384e79955aabf7792568d905725c062e1d2abc.jpeg)

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

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.

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [March 9, 2021, 7:30pm UTC](https://forum.opencv.org/t/image-quality-low-with-opencv/2057/2 "2021-03-09T19:30:20Z")

</div>

> [@Werti](#):
>
> - Making 5-20 images instead of just 1 (every image had roughly the same quality)

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.

> [@Werti](#):
>
> - Letting the camera run for several seconds

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