isaac_ros_image_proc
Source code on GitHub.
Quickstart
Set Up Development Environment
Set up your development environment by following the instructions in getting started.
Clone
isaac_ros_common
under${ISAAC_ROS_WS}/src
.cd ${ISAAC_ROS_WS}/src && \ git clone -b release-3.1 https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_common.git isaac_ros_common
(Optional) Install dependencies for any sensors you want to use by following the sensor-specific guides.
Warning
We strongly recommend installing all sensor dependencies before starting any quickstarts. Some sensor dependencies require restarting the Isaac ROS Dev container during installation, which will interrupt the quickstart process.
Datasets
Download Quickstart Assets
Download quickstart data from NGC:
Make sure required libraries are installed.
sudo apt-get install -y curl jq tar
Then, run these commands to download the asset from NGC:
NGC_ORG="nvidia" NGC_TEAM="isaac" PACKAGE_NAME="isaac_ros_image_proc" NGC_RESOURCE="isaac_ros_image_proc_assets" NGC_FILENAME="quickstart.tar.gz" MAJOR_VERSION=3 MINOR_VERSION=1 VERSION_REQ_URL="https://catalog.ngc.nvidia.com/api/resources/versions?orgName=$NGC_ORG&teamName=$NGC_TEAM&name=$NGC_RESOURCE&isPublic=true&pageNumber=0&pageSize=100&sortOrder=CREATED_DATE_DESC" AVAILABLE_VERSIONS=$(curl -s \ -H "Accept: application/json" "$VERSION_REQ_URL") LATEST_VERSION_ID=$(echo $AVAILABLE_VERSIONS | jq -r " .recipeVersions[] | .versionId as \$v | \$v | select(test(\"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+$\")) | split(\".\") | {major: .[0]|tonumber, minor: .[1]|tonumber, patch: .[2]|tonumber} | select(.major == $MAJOR_VERSION and .minor <= $MINOR_VERSION) | \$v " | sort -V | tail -n 1 ) if [ -z "$LATEST_VERSION_ID" ]; then echo "No corresponding version found for Isaac ROS $MAJOR_VERSION.$MINOR_VERSION" echo "Found versions:" echo $AVAILABLE_VERSIONS | jq -r '.recipeVersions[].versionId' else mkdir -p ${ISAAC_ROS_WS}/isaac_ros_assets && \ FILE_REQ_URL="https://api.ngc.nvidia.com/v2/resources/$NGC_ORG/$NGC_TEAM/$NGC_RESOURCE/\ versions/$LATEST_VERSION_ID/files/$NGC_FILENAME" && \ curl -LO --request GET "${FILE_REQ_URL}" && \ tar -xf ${NGC_FILENAME} -C ${ISAAC_ROS_WS}/isaac_ros_assets && \ rm ${NGC_FILENAME} fi
Build isaac_ros_image_proc
Launch the Docker container using the
run_dev.sh
script:cd ${ISAAC_ROS_WS}/src/isaac_ros_common && \ ./scripts/run_dev.sh
Install the prebuilt Debian package:
sudo apt-get install -y ros-humble-isaac-ros-image-proc
Clone this repository under
${ISAAC_ROS_WS}/src
:cd ${ISAAC_ROS_WS}/src && \ git clone -b release-3.1 https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_image_pipeline.git isaac_ros_image_pipeline
Launch the Docker container using the
run_dev.sh
script:cd ${ISAAC_ROS_WS}/src/isaac_ros_common && \ ./scripts/run_dev.sh
Use
rosdep
to install the package’s dependencies:rosdep install --from-paths ${ISAAC_ROS_WS}/src/isaac_ros_image_pipeline/isaac_ros_image_proc --ignore-src -y
Build the package from source:
cd ${ISAAC_ROS_WS}/ && \ colcon build --symlink-install --packages-up-to isaac_ros_image_proc --symlink-install
Source the ROS workspace:
Note
Make sure to repeat this step in every terminal created inside the Docker container.
Because this package was built from source, the enclosing workspace must be sourced for ROS to be able to find the package’s contents.
source install/setup.bash
Run Launch File
Continuing inside the Docker container, install the following dependencies:
sudo apt-get install -y ros-humble-isaac-ros-examples
Run the following launch file to spin up a demo of this package using the quickstart rosbag:
- Resize:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=resize
- Color Conversion:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=color_conversion interface_specs_file:=${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_image_proc/quickstart_interface_specs.json
- Crop:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=crop interface_specs_file:=${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_image_proc/quickstart_interface_specs.json
- Rectify:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=rectify_mono interface_specs_file:=${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_image_proc/quickstart_interface_specs.json
- Flip:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=flip
Open a second terminal inside the Docker container:
cd ${ISAAC_ROS_WS}/src/isaac_ros_common && \ ./scripts/run_dev.sh
Run the rosbag file to simulate an image stream:
ros2 bag play --loop ${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_image_proc/quickstart --remap /hawk_0_left_rgb_image:=/image_raw /hawk_0_left_rgb_camera_info:=/camera_info
Ensure that you have already set up your RealSense camera using the RealSense setup tutorial. If you have not, please set up the sensor and then restart this quickstart from the beginning.
Continuing inside the Docker container, install the following dependencies:
sudo apt-get install -y ros-humble-isaac-ros-examples ros-humble-isaac-ros-realsense
Run the following launch file to spin up a demo of this package using the quickstart rosbag:
- Resize:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=realsense_mono,resize
- Color Conversion:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=realsense_mono,color_conversion
- Crop:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=realsense_mono,crop
- Rectify:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=realsense_mono,rectify_mono
- Flip:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=realsense_mono,flip
Ensure that you have already set up your Hawk camera using the Hawk setup tutorial. If you have not, please set up the sensor and then restart this quickstart from the beginning.
Continuing inside the Docker container, install the following dependencies:
sudo apt-get install -y ros-humble-isaac-ros-examples ros-humble-isaac-ros-argus-camera
Run the following launch file to spin up a demo of this package using the quickstart rosbag:
- Resize:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=argus_mono,resize
- Color Conversion:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=argus_mono,color_conversion
- Crop:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=argus_mono,crop
- Rectify:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=argus_mono,rectify_mono
- Flip:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=argus_mono,flip
Note
For RealSense camera package issues, please refer to the section here.
Other supported cameras can be found here.
For camera calibration, please refer to this guide.
Visualize Results
Open a new terminal inside the Docker container:
cd ${ISAAC_ROS_WS}/src/isaac_ros_common && \ ./scripts/run_dev.sh
Observe the image_proc output on the terminal with the command:
- Resize:
ros2 run image_view image_view --ros-args --remap image:=resize/image
- Color Conversion:
ros2 run image_view image_view --ros-args --remap image:=image_mono
- Crop:
ros2 run image_view image_view --ros-args --remap image:=crop/image
- Rectify:
ros2 run image_view image_view --ros-args --remap image:=image_rect
- Flip:
ros2 run image_view image_view --ros-args --remap image:=image_flipped
Overview
The isaac_ros_image_proc
package offers functionality for
rectifying/undistorting images from a monocular camera setup, resizing
the image, and changing the image format. It largely replaces the
image_proc
package, though the image format conversion facility also
functions as a way to replace the CPU-based image format conversion in
cv_bridge
. The rectify node can also resize the image; if resizing
is not needed, specify the output width/height same as input.
Available Components
CropNode
ROS Parameters
ROS Parameter |
Type |
Default |
Description |
---|---|---|---|
|
|
|
The width of the input image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
The height of the input image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
The width of the output image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
The height of the output image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
Mode of operation to perform cropping. Valid values are - |
|
|
|
X value of the top left corner of a region of interest. This is only used when |
|
|
|
Y value of the top left corner of a region of interest. This is only used when |
|
|
|
The number of pre-allocated memory output blocks, should not be less than |
ROS Topics Subscribed
ROS Topic |
Interface |
Description |
---|---|---|
|
The input image that needs to be cropped. |
|
|
The corresponding camera_info of the input image. |
ROS Topics Published
ROS Topic |
Interface |
Description |
---|---|---|
|
Cropped image. |
|
|
The corresponding camera_info of the cropped image. |
ImageFlipNode
ROS Parameters
ROS Parameter |
Type |
Default |
Description |
---|---|---|---|
|
|
|
Axis to be use for flip operation. Valid values are - |
ROS Topics Subscribed
ROS Topic |
Interface |
Description |
---|---|---|
|
The input image that needs to be flipped. |
ROS Topics Published
ROS Topic |
Interface |
Description |
---|---|---|
|
Flipped image. |
ImageFormatConverterNode
ROS Parameters
ROS Parameter |
Type |
Default |
Description |
---|---|---|---|
|
|
|
The width of the input image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
The height of the input image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
Target color encoding to convert to. Valid values are - |
ROS Topics Subscribed
ROS Topic |
Interface |
Description |
---|---|---|
|
The input image data. |
ROS Topics Published
ROS Topic |
Interface |
Description |
---|---|---|
|
The output image data. |
ImageNormalizeNode
ROS Parameters
ROS Parameter |
Type |
Default |
Description |
---|---|---|---|
|
|
|
The mean of the image pixels per channel that will be used for normalization. |
|
|
|
The standard deviation of the image pixels per channel that will be used for normalization. |
ROS Topics Subscribed
ROS Topic |
Interface |
Description |
---|---|---|
|
The input image data. |
ROS Topics Published
ROS Topic |
Interface |
Description |
---|---|---|
|
The output image data. |
PadNode
ROS Parameters
ROS Parameter |
Type |
Default |
Description |
---|---|---|---|
|
|
|
The width of the output image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
The height of the output image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
Describes the padding mode. Valid values are - |
|
|
|
Describes how border values are calculated. Valid values are - |
|
|
|
RGBA color value for border color. |
ROS Topics Subscribed
ROS Topic |
Interface |
Description |
---|---|---|
|
The input image data. |
ROS Topics Published
ROS Topic |
Interface |
Description |
---|---|---|
|
The output image data. |
RectifyNode
ROS Parameters
ROS Parameter |
Type |
Default |
Description |
---|---|---|---|
|
|
|
The width of the output image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
The height of the output image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
ROS Topics Subscribed
ROS Topic |
Interface |
Description |
---|---|---|
|
The input image that needs to be rectified. |
|
|
The corresponding camera_info of the input image. |
ROS Topics Published
ROS Topic |
Interface |
Description |
---|---|---|
|
Rectified image. |
|
|
The corresponding camera_info of the rectified image. |
ResizeNode
ROS Parameters
ROS Parameter |
Type |
Default |
Description |
---|---|---|---|
|
|
|
The width of the input image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
The height of the input image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
The width of the output image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
The height of the output image. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
When enabled, aspect ratio of the original image will be preserved by adding black border. |
|
|
|
This value is used to mark the preference of output color format. |
|
|
|
When set to true, |
|
|
|
The number of pre-allocated memory output blocks, should not be less than |
ROS Topics Subscribed
ROS Topic |
Interface |
Description |
---|---|---|
|
The input image that needs to be resized. |
|
|
The corresponding camera_info of the input image. |
ROS Topics Published
ROS Topic |
Interface |
Description |
---|---|---|
|
Resized image. |
|
|
The corresponding camera_info of the resized image. |
Limitation: isaac_ros_image_proc
nodes require even number dimensions for
images.