1

A few weeks ago I saw on the internet that you could display a small dialog/ menu with a few properties of the camera. In this menu the user can change the contrast, brightness...but I can not find it anymore. Does somebody know the code to get this dialog?

Thank you in advance!

Odrai
  • 2,163
  • 2
  • 31
  • 62

2 Answers2

12

Set the property CV_CAP_PROP_SETTINGS with any value.

cv::VideoCapture cap(0); 
cap.set(CV_CAP_PROP_SETTINGS, 0); //opens camera properties dialog
Nima
  • 379
  • 3
  • 15
  • That's a very good tip. I tried to find out the parameter ranges for the different ``CV_CAP_PROP_XX`` manually, but with this dialogue things are much easier! – Phann Dec 06 '18 at 10:33
  • This works. Had to define the constant in C# See https://github.com/Kawaian/OpenCvSharp/blob/master/opencv/3.2/include/opencv2/videoio/videoio_c.h – Gary Kindel Sep 01 '22 at 12:58
0

OpenCV doesn't offer this functionality. Different camera manufacturers have different API's for accessing and changing camera parameters. There is no standard way to do this. So, you can try to access your camera settings using its API and then you can write your own GUI dialog window (for example, using QT library) to view/change the parameters.

Alexey
  • 5,898
  • 9
  • 44
  • 81
  • I am sure there was such a dialog of OpenCV! I only do not find/ know the code anymore... – Odrai Jun 14 '13 at 19:03
  • my guess is that it was a demo of OpenCV GUI, where user can change brightness/ contrast of an image. However, it may have been done by processing the image, as opposed to changing camera parameters. – Alexey Jun 14 '13 at 19:07
  • you probably should be able to look it up in OpenCV documentation if it exists. – Alexey Jun 14 '13 at 19:51
  • OpenCV has `C++: bool VideoCapture::set(int propId, double value)`, which can set properties, such as `CV_CAP_PROP_BRIGHTNESS`, but I couldn't find a dialog (one method call) version of it. – Alexey Jun 14 '13 at 20:07
  • I only know it was posted on stackoverflow :P – Odrai Jun 14 '13 at 20:11
  • [This answer](http://stackoverflow.com/a/11433221/1121420) might me helpful. I'm sure that currently you can't do it with just a couple of function calls in OpenCV. If you find the solution let me know. – Alexey Jun 14 '13 at 20:13
  • Unfortunately not. It was a dialog with a few trackbars to change contrast/ brightness/ sharpness... Or is it possible that the VideoInput lib this has? – Odrai Jun 14 '13 at 20:20
  • No, there isn't a trivial method in OpenCV. One would need to create a Qt dialog window and trackbars (`createTrackbar()`), etc, and then to use some method to set camera parameters. – Alexey Jun 14 '13 at 20:27
  • I think it is: VI.showSettingsWindow(device1); of the videoInput library. I will try it tomorrow. My fault that I thought OpenCV contains this window. – Odrai Jun 14 '13 at 20:30
  • glad you found it. I think I answered your question though, right? – Alexey Jun 14 '13 at 20:36