Skip to content

Commit

Permalink
Added parameters for white balance
Browse files Browse the repository at this point in the history
  • Loading branch information
dekent committed Nov 4, 2014
1 parent b844305 commit b25c293
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions nodes/usb_cam_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ class UsbCamNode

// parameters
std::string video_device_name_, io_method_name_, pixel_format_name_, camera_name_, camera_info_url_;
int image_width_, image_height_, framerate_, exposure_, brightness_, contrast_, saturation_, sharpness_, focus_;
bool autofocus_, autoexposure_;
int image_width_, image_height_, framerate_, exposure_, brightness_, contrast_, saturation_, sharpness_, focus_,
white_balance_;
bool autofocus_, autoexposure_, auto_white_balance_;
boost::shared_ptr<camera_info_manager::CameraInfoManager> cinfo_;

UsbCamNode() :
Expand Down Expand Up @@ -84,6 +85,9 @@ class UsbCamNode
// enable/disable autoexposure
node_.param("autoexposure", autoexposure_, true);
node_.param("exposure", exposure_, 100);
// enable/disable auto white balance temperature
node_.param("auto_white_balance", auto_white_balance_, true);
node_.param("white_balance", white_balance_, 4000);

// load the camera info
node_.param("camera_frame_id", img_.header.frame_id, std::string("head_camera"));
Expand Down Expand Up @@ -146,6 +150,15 @@ class UsbCamNode
paramstream << "sharpness=" << sharpness_;
this->set_v4l_parameters(video_device_name_, paramstream.str());

// check auto white balance
if (!auto_white_balance_)
{
this->set_v4l_parameters(video_device_name_, "white_balance_temperature_auto=0");
std::stringstream ss;
ss << "white_balance_temperature=" << white_balance_;
this->set_v4l_parameters(video_device_name_, ss.str());
}

// check auto exposure
if (!autoexposure_)
{
Expand Down

0 comments on commit b25c293

Please sign in to comment.