Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusting the white balance #116

Closed
shervinkoushan opened this issue Feb 23, 2023 · 10 comments
Closed

Adjusting the white balance #116

shervinkoushan opened this issue Feb 23, 2023 · 10 comments

Comments

@shervinkoushan
Copy link

Would it be possible to adjust the balance_ratio for both Red and Blue?

Currently only one at a time is supported, but the calibration we get from Vimba Viewer has values for both.

@icolwell-as
Copy link
Member

Are you using ROS1 or ROS2?
The ROS2 driver has an improved parameter management system, so any feature/parameter available from the camera is also available as a ROS2 parameter.

If you are using ROS1, someone will need to implement the ROS parameter and open a PR.

@Eeaeau
Copy link

Eeaeau commented Feb 23, 2023

Are you using ROS1 or ROS2? The ROS2 driver has an improved parameter management system, so any feature/parameter available from the camera is also available as a ROS2 parameter.

If you are using ROS1, someone will need to implement the ROS parameter and open a PR.

We need to be using ROS1.

@shervinkoushan
Copy link
Author

Actually, it does not seem like setting even one value in the launch file works.

For reference, we are using a 1800-U-052C USB camera and running on Ubuntu 18.0, branch melodic

@icolwell-as
Copy link
Member

What launch file are you using and with what args/parameters?
Maybe try the ros1_master branch, there were some unreleased improvements to the nodelet launch files, if you are using those.

@Eeaeau
Copy link

Eeaeau commented Feb 23, 2023

What launch file are you using and with what args/parameters? Maybe try the ros1_master branch, there were some unreleased improvements to the nodelet launch files, if you are using those.

We used the melodic branch. We have not used the nodelet as we had some issues with that. We will try ros1_master tomorrow :).

@shervinkoushan
Copy link
Author

shervinkoushan commented Feb 24, 2023

We tried the ros1_master branch now. The balance_ratio parameters do not seem to have any effect here either. All our parameters are listed below:

<launch>
  <!-- Driver parameters, these parameters affect the way the ROS driver works -->
  <arg name="name" default="camera" doc="The name of the camera"/>
  <arg name="ip" default="" doc="The IP for the camera to connect to"/>
  <arg name="guid" default="DEV_1AB22C02933D" doc="The GUID for the camera to connect to"/>
  <arg name="frame_id" default="$(arg name)" doc="The frame id of the camera"/>
  <arg name="use_measurement_time" default="false" doc="Use the measurement time from the camera"/>
  <arg name="ptp_offset" default="-37" doc="Offset to add to the timestamp from the camera (s).
    Useful for converting from TAI to UTC time. Only applies if use_measurement_time is true"/>
  <arg name="camera_info_url" default="file://$(find avt_vimba_camera)/calibrations/calibration_example.yaml"/>
  <arg name="print_all_features" default="false" doc="Show all camera features on the console during startup"/>
  <arg name="image_proc" default="false" doc="Launch image_proc with driver"/>

  <!-- Camera parameters, these parameters are used to configure the AVT camera upon startup -->
  <!-- See the cfg/AvtVimbaCamera.cfg file for documentation -->

  <!-- Acquisition -->
  <arg name="acquisition_mode" default="Continuous"/>
  <arg name="acquisition_rate" default="10"/>
  <!-- Trigger -->
  <arg name="trigger_source" default="Off"/>
  <arg name="trigger_mode" default="Off"/>
  <arg name="trigger_selector" default="FrameStart"/>
  <arg name="trigger_activation" default="RisingEdge"/>
  <arg name="trigger_delay" default="0.0"/>
  <!-- Exposure -->
  <arg name="exposure" default="50000"/>
  <arg name="exposure_auto" default="Continuous"/>
  <arg name="exposure_auto_alg" default="FitRange"/>
  <arg name="exposure_auto_tol" default="5"/>
  <arg name="exposure_auto_max" default="50000"/>
  <arg name="exposure_auto_min" default="50000"/>
  <arg name="exposure_auto_outliers" default="50000"/>
  <arg name="exposure_auto_rate" default="50000"/>
  <arg name="exposure_auto_target" default="50000"/>
  <!-- Gain -->
  <arg name="gain" default="10"/>
  <arg name="gain_auto" default="Off"/>
  <arg name="gain_auto_adjust_tol" default="5"/>
  <arg name="gain_auto_max" default="32"/>
  <arg name="gain_auto_min" default="0"/>
  <arg name="gain_auto_outliers" default="0"/>
  <arg name="gain_auto_rate" default="50"/>
  <arg name="gain_auto_target" default="50"/>
  <!-- White Balance -->
  <arg name="balance_ratio_abs" default="3"/>
  <arg name="balance_ratio_selector" default="Red"/>
  <arg name="whitebalance_auto" default="Off"/>
  <arg name="whitebalance_auto_tol" default="5"/>
  <arg name="whitebalance_auto_rate" default="100"/>
  <!-- Binning and Decimation -->
  <arg name="binning_x" default="1"/>
  <arg name="binning_y" default="1"/>
  <arg name="decimation_x" default="1"/>
  <arg name="decimation_y" default="1"/>
  <!-- ROI -->
  <arg name="width" default="816"/>
  <arg name="height" default="624"/>
  <arg name="offset_x" default="0"/>
  <arg name="offset_y" default="0"/>
  <!-- Pixel Format -->
  <arg name="pixel_format" default="RGB8"/>
  <!-- Bandwidth -->
  <arg name="stream_bytes_per_second" default="45000000"/>
  <!-- PTP Synchronization -->
  <arg name="ptp_mode" default="Off"/>
  <!-- GPIO -->
  <arg name="sync_in_selector" default="SyncIn1"/>
  <arg name="sync_out_polarity" default="Normal"/>
  <arg name="sync_out_selector" default="SyncOut1"/>
  <arg name="sync_out_source" default="GPO"/>
  <!-- USB GPIO -->
  <arg name="line_selector" default="Line0"/>
  <arg name="line_mode" default="Input"/>
  <!-- Iris -->
  <arg name="iris_auto_target" default="50"/>
  <arg name="iris_mode" default="Continuous"/>
  <arg name="iris_video_level_min" default="110"/>
  <arg name="iris_video_level_max" default="110"/>

  <group if="$(arg image_proc)" ns="$(arg name)">
    <node name="image_proc" pkg="image_proc" type="image_proc"/>
  </group>

  <node name="$(arg name)" pkg="avt_vimba_camera" type="mono_camera_node" output="screen">
    <param name="ip" value="$(arg ip)"/>
    <param name="guid" value="$(arg guid)"/>
    <param name="frame_id" value="$(arg frame_id)"/>
    <param name="use_measurement_time" value="$(arg use_measurement_time)"/>
    <param name="ptp_offset" value="$(arg ptp_offset)"/>
    <param name="camera_info_url" value="$(arg camera_info_url)"/>
    <param name="print_all_features" value="$(arg print_all_features)"/>

    <param name="acquisition_mode" value="$(arg acquisition_mode)"/>
    <param name="acquisition_rate" value="$(arg acquisition_rate)"/>

    <param name="trigger_source" value="$(arg trigger_source)"/>
    <param name="trigger_mode" value="$(arg trigger_mode)"/>
    <param name="trigger_selector" value="$(arg trigger_selector)"/>
    <param name="trigger_activation" value="$(arg trigger_activation)"/>
    <param name="trigger_delay" value="$(arg trigger_delay)"/>

    <param name="exposure" value="$(arg exposure)"/>
    <param name="exposure_auto" value="$(arg exposure_auto)"/>
    <param name="exposure_auto_alg" value="$(arg exposure_auto_alg)"/>
    <param name="exposure_auto_tol" value="$(arg exposure_auto_tol)"/>
    <param name="exposure_auto_max" value="$(arg exposure_auto_max)"/>
    <param name="exposure_auto_min" value="$(arg exposure_auto_min)"/>
    <param name="exposure_auto_outliers" value="$(arg exposure_auto_outliers)"/>
    <param name="exposure_auto_rate" value="$(arg exposure_auto_rate)"/>
    <param name="exposure_auto_target" value="$(arg exposure_auto_target)"/>

    <param name="gain" value="$(arg gain)"/>
    <param name="gain_auto" value="$(arg gain_auto)"/>
    <param name="gain_auto_adjust_tol" value="$(arg gain_auto_adjust_tol)"/>
    <param name="gain_auto_max" value="$(arg gain_auto_max)"/>
    <param name="gain_auto_min" value="$(arg gain_auto_min)"/>
    <param name="gain_auto_outliers" value="$(arg gain_auto_outliers)"/>
    <param name="gain_auto_rate" value="$(arg gain_auto_rate)"/>
    <param name="gain_auto_target" value="$(arg gain_auto_target)"/>

    <param name="balance_ratio_abs" value="$(arg balance_ratio_abs)"/>
    <param name="balance_ratio_selector" value="$(arg balance_ratio_selector)"/>
    <param name="whitebalance_auto" value="$(arg whitebalance_auto)"/>
    <param name="whitebalance_auto_tol" value="$(arg whitebalance_auto_tol)"/>
    <param name="whitebalance_auto_rate" value="$(arg whitebalance_auto_rate)"/>

    <param name="binning_x" value="$(arg binning_x)"/>
    <param name="binning_y" value="$(arg binning_y)"/>
    <param name="decimation_x" value="$(arg decimation_x)"/>
    <param name="decimation_y" value="$(arg decimation_y)"/>

    <param name="width" value="$(arg width)"/>
    <param name="height" value="$(arg height)"/>
    <param name="offset_x" value="$(arg offset_x)"/>
    <param name="offset_y" value="$(arg offset_y)"/>

    <param name="pixel_format" value="$(arg pixel_format)"/>

    <param name="stream_bytes_per_second" value="$(arg stream_bytes_per_second)"/>

    <param name="ptp_mode" value="$(arg ptp_mode)"/>

    <param name="sync_in_selector" value="$(arg sync_in_selector)"/>
    <param name="sync_out_polarity" value="$(arg sync_out_polarity)"/>
    <param name="sync_out_selector" value="$(arg sync_out_selector)"/>
    <param name="sync_out_source" value="$(arg sync_out_source)"/>

    <param name="line_selector" value="$(arg line_selector)"/>
    <param name="line_mode" value="$(arg line_mode)"/>

    <param name="iris_auto_target" value="$(arg iris_auto_target)"/>
    <param name="iris_mode" value="$(arg iris_mode)"/>
    <param name="iris_video_level_min" value="$(arg iris_video_level_min)"/>
    <param name="iris_video_level_max" value="$(arg iris_video_level_max)"/>
  </node>
</launch>

@icolwell-as
Copy link
Member

Ok, I've never used the USB alvium cameras, but my best guess is that maybe the feature/parameter names are slightly different for this camera. Check this topic where is was discovered that there are differences in the feature names based on the model of camera:
#86

When you first start the node do you see any of these prints? https://github.com/astuff/avt_vimba_camera/blob/ros1_master/src/avt_vimba_camera.cpp#L575

Something like "Tried to set x but ...", or maybe "Could not get feature x, your camera probably doesn't support it."

@Eeaeau
Copy link

Eeaeau commented Feb 28, 2023

Hmm, that could be the case! We do indeed see a lot of those messages.

The naming in vimba viewer is different, should it match the ros driver config?
image

@icolwell-as
Copy link
Member

For the features supported by the Alvium 1800-U-052C, you'll want to review the feature reference document for Alvium:
https://cdn.alliedvision.com/fileadmin/content/documents/products/cameras/various/features/Alvium_Features_Reference.pdf

The feature reference document will tell you all the features and their exact names that are supported by alvium series cameras.
Then you can update the code here: https://github.com/astuff/avt_vimba_camera/blob/ros1_master/src/avt_vimba_camera.cpp#L1055
According to what parameters/features you want for your camera.

Another option is using the ROS2 driver along with the ros1_bridge, since the ROS2 driver ensures all supported features are exposed as ROS2 params automatically.

@shervinkoushan
Copy link
Author

Thanks for pointing us in the right direction!

We got it working with this repository: https://github.com/Mkarasneh/avt_vimba_camera

Another question is how to achieve 12 bit output, but I can open another issue for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants