How to set/get camera properties on Mac OS X
I am using OpenCV3 on Mac OS X. I want to get/set camera properties. Whatever value I tryout it has no effect. I wrote a simple code to see which properties are available and tried this with different webcams I own. But I could not get any values from any of the cams.
- Is there something wrong in my code?
- Does the Mac OS X backend not support to get/set camera properties?
- Which webcams are fully controllable?
The code you can get as attachment.
Thx and regards Alexander
// The code I am using
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
// Start default camera
VideoCapture video(0);
//Alexander
float Brightness = video.get(CV_CAP_PROP_BRIGHTNESS);
float Contrast = video.get(CV_CAP_PROP_CONTRAST );
float Saturation = video.get(CV_CAP_PROP_SATURATION);
float Gain = video.get(CV_CAP_PROP_GAIN);
float Position = video.get(CV_CAP_PROP_POS_MSEC);
float Width = video.get(CV_CAP_PROP_FRAME_WIDTH);
float Height = video.get(CV_CAP_PROP_FRAME_HEIGHT);
float Format = video.get(CV_CAP_PROP_FORMAT);
double Hue = video.get(CV_CAP_PROP_HUE);
double Exposure = video.get(CV_CAP_PROP_EXPOSURE);
double Mode = video.get(CV_CAP_PROP_MODE);
double fps = video.get(CV_CAP_PROP_FPS);
cout<<"Brightness -------> "<<Brightness<<endl;
cout<<"Contrast----------> "<<Contrast<<endl;
cout<<"Saturation--------> "<<Saturation<<endl;
cout<<"Gain--------------> "<<Gain<<endl;
cout<<"Hue---------------> "<<Hue<<endl;
cout<<"Exposure----------> "<<Exposure<<endl;
cout<<"Mode--------------> "<<Mode<<endl;
cout<<"Position---------->"<<Position<<endl;
cout<<"Width------------->"<<Width<<endl;
cout<<"Height------------>"<<Height<<endl;
cout<<"Format------------>"<<Format<<endl;
cout<<"Frames---------->"<<fps<<endl<<endl;
return 0;
}
...and what are the results?
Your code looks fine. Can you give us more details about your setup? Did you compile OpenCV yourself? If yes, did you enable V4L? Did you have libv4l-dev package installed?
Can you grab images from the webcam?
Mac OS X 10.14.2 Mojave
Is this available on Mac OS X?
I did not - if it is not set in macports.
To be precise: I try to workout how to control camera parameters like Brightness, saturation Hue and others. I set values to th
Hi there,
I came back to my project ... I am now using opencv4.2. But still I do not get any more options to work as before. Also it responds always empty frames ...
Anny ideas.