View my account

Setting Auto-Exposure Region-of-Interest with ROS2

Comments

12 comments

  • MartyG

    Hi Toni Divic  In ROS1 the depth auto-exposure ROI can be set in the launch file like this:

     

      <rosparam>
          /camera/stereo_module/auto_exposure_roi/left: 20
          /camera/stereo_module/auto_exposure_roi/right: 200
      </rosparam>

     

    I am not aware of a past case of the auto-exposure ROI being defined in the RealSense ROS2 wrapper.  It is probable though that the ROI parameters could be set in ROS2 using the ros2 param set command.  Applying the general structure of a ros2 param set instruction to the information above, a ROS2 ROI command might look like the ones below.

     

    ros2 param set /camera/camera auto_exposure_roi/left 20
    ros2 param set /camera/camera auto_exposure_roi/right 200
    0
    Comment actions Permalink
  • Toni Divic

    Ok, I will try that out. Can you clarify the units of those parameters (I assume pixels?), as well as their max/min values? Are there also "top" and "bottom" parameters?

    0
    Comment actions Permalink
  • MartyG

    There is not a definition for the left and right ROI parameters in ROS, and there are not top and bottom parameters.  I would speculate without knowing for certain though that left and right refer to a start horizontal coordinate and an end vertical coordinate, allowing a ROI box to be drawn between those two coordinates.

     

    0
    Comment actions Permalink
  • Toni Divic

    How is the height of the box defined then? It seems like left = 20 and right = 200 defines the width, I'm not sure I understand where the height comes in

     

    0
    Comment actions Permalink
  • MartyG

    I just updated my comment above with a better possible explanation to account for the height.  As I said though, the actual meaning of the parameters is not defined and so it is speculation on my part.

    0
    Comment actions Permalink
  • Toni Divic

    Hmm, not sure if I fully understand still. Are you suggesting each coordinate can be defined by a single value (e.g. if each row has 10 pixels, row 0 has coordinates 0-9, then row 1 continues with 10-19, etc)? 

    Is there somewhere I can find more in-depth information? Or is there a way for me to set the ROI parameters then visualize what region is drawn so I can figure out the coordinate system?

    0
    Comment actions Permalink
  • MartyG

    The number of horizontal and vertical pixels in an image is determined by the resolution.  So in an 848x480 image there will be 848 pixels in the horizontal direction and 480 pixels in the vertical direction.  So 20 would be 20 pixels in horizontally from the left top corner of the image and 200 would be 200 pixels down vertically from the top of the image.

     

    The center-point of an image is half of the resolution.  So on an 848x480 image, the center coordinate would be 424x240.

    0
    Comment actions Permalink
  • MartyG

    The librealsense SDK uses a different coordinate system for setting the ROI, by defining a minimum and maximum X and Y.

    https://intelrealsense.github.io/librealsense/doxygen/rs__sensor_8h.html#a457c886c822167821da60151700f0d5f

    0
    Comment actions Permalink
  • Toni Divic

    Yeah, I understand how the coordinate system typically would work, it just doesn't make sense to me how we can define a box with only 2 values. I would expect a minimum of 4, like in the librealsense SDK. 

    Is there a way you can confirm the values in ROS2 with the development team somehow, or should I just assume that ROI isn't yet supported in ROS2?

     

    0
    Comment actions Permalink
  • MartyG

    You should be able to confirm whether ROI information is being published by performing a ros2 topic echo on the topics below.

    /camera/stereo_module/auto_exposure_roi/parameter_descriptions

    /camera/stereo_module/auto_exposure_roi/parameter_updates

    0
    Comment actions Permalink
  • Toni Divic

    I connected a camera and did a ros2 param dump, and found the four parameters needed are there:

    /camera0/depth_module/auto_exposure_roi/bottom

    /camera0/depth_module/auto_exposure_roi/left

    /camera0/depth_module/auto_exposure_roi/right

    /camera0/depth_module/auto_exposure_roi/top

    0
    Comment actions Permalink
  • MartyG

    Thanks very much for the information!

    0
    Comment actions Permalink

Please sign in to leave a comment.