isaac_ros_image_proc#
Source code available on GitHub.
Quickstart#
Set Up Development Environment#
Set up your development environment by following the instructions in getting started.
(Optional) Install dependencies for any sensors you want to use by following the sensor-specific guides.
Note
We strongly recommend installing all sensor dependencies before starting any quickstarts. Some sensor dependencies require restarting the development environment 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=4 MINOR_VERSION=0 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#
Activate the Isaac ROS environment:
isaac-ros activateInstall the prebuilt Debian package:
sudo apt-get update
sudo apt-get install -y ros-jazzy-isaac-ros-image-proc
Install Git LFS:
sudo apt-get install -y git-lfs && git lfs install
Clone this repository under
${ISAAC_ROS_WS}/src:cd ${ISAAC_ROS_WS}/src && \ git clone -b release-4.0 https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_image_pipeline.git isaac_ros_image_pipeline
Activate the Isaac ROS environment:
isaac-ros activateUse
rosdepto install the package’s dependencies:sudo apt-get update
rosdep update && 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 --base-paths ${ISAAC_ROS_WS}/src/isaac_ros_image_pipeline/isaac_ros_image_proc
Source the ROS workspace:
Note
Make sure to repeat this step in every terminal created inside the Isaac ROS environment.
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#
Note
The quickstart for the alpha blending node has been integrated into isaac_ros_unet image segmentation.
To run and visualize the results of alpha blending, see here.
Continuing inside the Isaac ROS environment, install the following dependencies:
sudo apt-get update
sudo apt-get install -y ros-jazzy-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 Isaac ROS environment:
isaac-ros activateRun 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 Isaac ROS environment, install the following dependencies:
sudo apt-get update
sudo apt-get install -y ros-jazzy-isaac-ros-examples ros-jazzy-isaac-ros-realsense
Run the following launch file to spin up a demo of this package using RealSense camera:
- 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 ZED camera using ZED setup tutorial.
Continuing inside the Isaac ROS environment, install the following dependencies:
sudo apt-get update
sudo apt-get install -y ros-jazzy-isaac-ros-examples ros-jazzy-isaac-ros-zed
Run the following launch file to spin up a demo of this package using ZED camera:
- Resize:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=zed_mono,resize \ interface_specs_file:=${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_image_proc/zed2_quickstart_interface_specs.json
- Color Conversion:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=zed_mono,color_conversion \ interface_specs_file:=${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_image_proc/zed2_quickstart_interface_specs.json
- Crop:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=zed_mono,crop \ interface_specs_file:=${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_image_proc/zed2_quickstart_interface_specs.json
- Rectify:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=zed_mono,rectify_mono \ interface_specs_file:=${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_image_proc/zed2_quickstart_interface_specs.json
- Flip:
ros2 launch isaac_ros_examples isaac_ros_examples.launch.py launch_fragments:=zed_mono,flip \ interface_specs_file:=${ISAAC_ROS_WS}/isaac_ros_assets/isaac_ros_image_proc/zed2_quickstart_interface_specs.json
Note
If you are using the ZED X series, replace zed2_quickstart_interface_specs.json with zedx_quickstart_interface_specs.json in the above command.
Visualize Results#
Open a new terminal inside the Isaac ROS environment:
isaac-ros activateObserve 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, changing the image format, and alpha blending two images. 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#
AlphaBlendNode#
ROS Parameters#
ROS Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
The alpha value, where 0 represents the image input being fully transparent and the mask input fully opaque. This is a mandatory parameter and needs to be between 0 and 1 inclusive. |
|
|
|
The queue size of the image input. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
The queue size of the mask input. This is a mandatory parameter and needs to be set to a non-zero positive number. |
|
|
|
The queue size of the time synchronizer. 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 to blend. |
|
|
The mask image to blend. |
ROS Topics Published#
ROS Topic |
Interface |
Description |
|---|---|---|
|
Blended image. |
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 - |
|
|
|
The number of pre-allocated memory output blocks, should not be less than |
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. |
|
|
|
The horizontal interval used for generating rectify warp grid points. It must be power-of-two and must be greater than or equal to 1. |
|
|
|
The vertical interval used for generating rectify warp grid points. It must be power-of-two and must be greater than or equal to 1. |
|
|
|
The interpolation type. Choices are: |
|
|
|
The boarder type specifies how the pixel values outside of the image should be constructed.
Choices are: |
|
|
|
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 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.