Rosanswers logo

Is there any way of lower the Kinect RGB image resolution from 640 * 480 to 320 * 240 when using the openni_launch package? I know it can be done in the openni_camera launch file by changing the image mode but I cant use this because depth doesn't show when I do for some reason. The reason I need to lower it is because I'm using cv_bridge to opencv but with the higer resolution this part runs unacceptably slowly.

Originally posted by Tadhg Fitzgerald on ROS Answers with karma: 98 on 2013-02-19

Post score: 2


2 Answers 2


Rosanswers logo

Have a look for information about ROS Dynamic Reconfigure. That allows you to change the resolution on-the-fly. Look at the params under the openni driver node.

Once you have found the parameter, you should be able to set it in a launch file like any other ROS Param.

Edit: I needed to test this myself...

Firstly test the supported parameters by changing them on the fly and viewing the output in Rviz:

$ rosrun dynamic_reconfigure reconfigure_gui

and selecting the node:

The ASUS/PrimeSense supports at least:

  image_mode: 2 (640x480 VGA 30Hz)
              5 (320x240 QVGA 30Hz)
              8 (160x120 QQVGA 30Hz)
  depth_mode: 2 (VGA 30Hz)
              5 (QVGA 30Hz)
              8 (QQVGA 30Hz)

Here are 2 separate examples of launching the dynamic reconfigure node to change some parameters:

    <node name="$(anon dynparam)" pkg="dynamic_reconfigure" type="dynparam" args="set_from_parameters tilt_hokuyo_node">
      <param name="intensity" type="bool" value="false" />
      <param name="min_ang" type="double" value="-1.15" />
      <param name="max_ang" type="double" value="1.15" />

  <node name="pr2_arm_navigation_perception_change_narrow_stereo_params_speckle" pkg="dynamic_reconfigure" type="dynparam" 
    args="set /narrow_stereo_textured/narrow_stereo_textured_proc speckle_size 1000" />

Or can specify the OpenNI driver configuration via ROS params:

  <arg name="kinect_frame_prefix" default="/head_mount_kinect" />
  <arg name="kinect_camera_name" default="head_mount_kinect" />
  <arg name="publish_tf" default="true" />

  <!-- Set driver params for 320x240 at 1-2 Hz frame rate -->
  <param name="/$(arg kinect_camera_name)/driver/data_skip" value="10" /> <!-- 0 is default, 10 will drop 9/10 frames -->
  <param name="/$(arg kinect_camera_name)/driver/image_mode" value="5" /> <!-- 2 is default -->
  <param name="/$(arg kinect_camera_name)/driver/depth_mode" value="5" /> <!-- 2 is default -->

  <include file="$(find openni_launch)/launch/openni.launch">
    <arg name="device_id" value="#1" /> <!-- Use 1st device found, or you can specify first device on USB Bus #2 using 2@0 -->
    <arg name="camera" value="$(arg kinect_camera_name)" />
    <arg name="rgb_frame_id" value="$(arg kinect_frame_prefix)_rgb_optical_frame" />
    <arg name="depth_frame_id" value="$(arg kinect_frame_prefix)_ir_optical_frame" />
    <arg name="publish_tf" value="$(arg publish_tf)"/>
    <arg name="respawn" value="true"/>
    <arg name="depth_registration" value="true"/>


Originally posted by dbworth with karma: 1103 on 2013-02-19

This answer was ACCEPTED on the original site

Post score: 9

Original comments

Comment by Tadhg Fitzgerald on 2013-02-20:
Thank you very much for the in depth answer!

Comment by ZiyangLI on 2014-02-25:
Really a good answer!


Rosanswers logo

Besides using dynamic_reconfigure as @dbworth suggested, you might want to use nodelets if you are passing images around in a single machine. That will make communication much faster ("zero-copy", as they say) while maintaining the modularity of nodes. Most of the image pipeline already supports nodelets.

Originally posted by georgebrindeiro with karma: 1264 on 2013-02-19

This answer was NOT ACCEPTED on the original site

Post score: 1


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.