Controlling webcam parameters/settings?

#1

Hello everyone, I was wondering if its possible to adjust a webcam settings (things like gain, exposure, brightness, contrast, etc), theres a videoSettings() function in ofVideoGrabber but when called it doesn’t seem to do anything, I remember a while ago somebody came up with a library that did this for the ps3 eye under osx. I am also using the ps3 eye but in ubuntu, does anyone know a way to do this??

Saludos!!
Jlafarga

#2

haven’t used it with the ps3 eye but this use to work well with other cameras:

#3

Hello @arturo is it possible to use your addon on raspbian stretch?
I’ve installed dependencies but example doesn’t work
Cheers,

#4

I believe it should work but haven’t tried it in a while. some initialization might have change or something but not sure. do you see any error or it just doesn’t do anything?

#5
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.h:22:13: error: 'string' has not been declared
  bool setup(string device);
             ^~~~~~
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.h:23:11: error: 'string' has not been declared
  bool set(string name, int value);
           ^~~~~~
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.h:37:3: error: 'vector' does not name a type
   vector<string> menu_options;
   ^~~~~~
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.h:50:30: error: 'string' has not been declared
  ofParameter<int> operator[](string name){
                              ^~~~~~
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.h:59:2: error: 'map' does not name a type
  map<string,Control> controls;
  ^~~
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.h:62:9: error: 'string' does not name a type
  static string LOG_NAME;
         ^~~~~~
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.h: In member function 'ofParameter<int> ofxV4L2Settings::operator[](int)':
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.h:51:30: error: no matching function for call to 'ofParameterGroup::contains(int&)'
   if(parameters.contains(name)){
                              ^
In file included from /home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.h:14:0,
                 from /home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.cpp:8:
/home/pi/openFrameworks/libs/openFrameworks/types/ofParameter.h:226:7: note: candidate: bool ofParameterGroup::contains(const string&) const
  bool contains(const std::string& name) const;
       ^~~~~~~~
/home/pi/openFrameworks/libs/openFrameworks/types/ofParameter.h:226:7: note:   no known conversion for argument 1 from 'int' to 'const string& {aka const std::__cxx11::basic_string<char>&}'
In file included from /home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.cpp:8:0:
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.h:54:15: error: 'LOG_NAME' was not declared in this scope
    ofLogError(LOG_NAME) << "parameter " << name << " doesn't exist returning empty parameter";
               ^~~~~~~~
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.cpp: At global scope:
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.cpp:21:1: error: 'string' does not name a type
 string ofxV4L2Settings::LOG_NAME = "ofxV4L2Settings";
 ^~~~~~
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.cpp: In constructor 'ofxV4L2Settings::Control::Control(int, const v4l2_queryctrl&, const v4l2_control&)':
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.cpp:34:16: error: 'LOG_NAME' was not declared in this scope
   ofLogVerbose(LOG_NAME) << "control menu for " << ctrl.name;
                ^~~~~~~~
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.cpp:39:5: error: 'menu_options' was not declared in this scope
     menu_options.push_back((char*)menu.name);
     ^~~~~~~~~~~~
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.cpp: At global scope:
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.cpp:56:29: error: 'bool ofxV4L2Settings::setup' is not a static data member of 'class ofxV4L2Settings'
 bool ofxV4L2Settings::setup(string device){
                             ^~~~~~
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.cpp:56:29: error: 'string' was not declared in this scope
/home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.cpp:56:29: note: suggested alternatives:
In file included from /usr/include/c++/6/string:39:0,
                 from /home/pi/openFrameworks/libs/openFrameworks/utils/ofConstants.h:270,
                 from /home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.h:11,
                 from /home/pi/openFrameworks/addons/ofxV4L2Settings/src/ofxV4L2Settings.cpp:8:
/usr/include/c++/6/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
   typedef basic_string<char>    string;
                                 ^~~~~~
/usr/include/c++/6/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:358: recipe for target '/home/pi/openFrameworks/addons/obj/linuxarmv6l/Release/ofxV4L2Settings/src/ofxV4L2Settings.o' failed
make[1]: *** [/home/pi/openFrameworks/addons/obj/linuxarmv6l/Release/ofxV4L2Settings/src/ofxV4L2Settings.o] Error 1
make[1]: Leaving directory '/home/pi/openFrameworks/addons/ofxV4L2Settings/example'
/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:124: recipe for target 'Release' failed
make: *** [Release] Error 2
#6

oh i see, in 0.10 we removed std from the global namespace so in .h files, things like map, string… should be preceded by std:: as in std::string or std::vector

for cpp’s you can simply add at the beginning of the file::

using namespace std;

and keep using this classes without the std prefix.

If you fix it please send me a PR

1 Like
#7

PR sent! working on Raspbian here