# QRB-ROS-color-space-convert
The `qrb-ros-color-space-convert` sample application converts between NV12 and RGB888 formats.
Qualcomm's smart devices, such as the Qualcomm Dragonwing^TM^ RB3 Gen 2 development kits, use NV12 as the default image color space conversion format. However, the more common color space format is RGB888.
The `qrb-ros-color-space-convert` sample application implements the following:
- Provides ROS nodes
>
>
> - API to convert NV12 to RGB888
> - API to convert RGB888 to NV12
- Supports `dmabuf` fd as input and output
- Input and output image receive and send with QRB ROS transport
- Hardware acceleration with GPU by OpenGL ES
## Pipeline flow for `qrb-ros-color-space-convert`
The figure shows the pipeline for `qrb-ros-color-space-convert`.
**Figure : qrb-ros-color-space-convert pipeline**
## ROS nodes used in the `qrb-ros-color-space-convert` pipeline
Table : ROS node used in qrb-ros-color-space-convert pipeline
| ROS Node | Description |
| --- | --- |
| `custom_ros_node` | `custom_ros_node` is the ROS package that publishes the input image information to the colorspace\_convert\_node. You should implement this ROS2 node. |
| `colorspace_convert_node` | `colorspace_convert_node` is a ROS package to convert color space between NV12 and RGB888. |
## ROS topics used in the `qrb-ros-color-space-convert` pipeline
Table : ROS topics used in qrb-ros-color-space-convert pipeline
| Names | Input/Output | Communicate Type | Message Type | Description |
| --- | --- | --- | --- | --- |
| `/image_raw` | input | topic | `` | NV12/RGB8 image data |
| `/image` | output | topic | `` | NV12/RGB8 image data |
## Prerequisites
- You have **Set up the device** according to [Set up the environment for running sample applications](https://docs.qualcomm.com/doc/80-70020-265/topic/quick_start.html#setup-demo-qs).
- The `custom_ros_node` is ready.
- You have connected the device to the display monitor.
## Run out-of-the-box `qrb-ros-color-space-convert`
**Steps:**
1. Set up the runtime environment.
Value range of `ROS_DOMAIN_ID`: [0, 232]
# Set up the runtime environment
(ssh) source /usr/share/qirp-setup.sh
(ssh) export ROS_DOMAIN_ID=xx
# Set up the Weston environment
(ssh) export XDG_RUNTIME_DIR=/dev/socket/weston/
(ssh) mkdir -p $XDG_RUNTIME_DIR
(ssh) export WAYLAND_DISPLAY=wayland-1
# Set up the shared memory
(ssh) export FASTRTPS_DEFAULT_PROFILES_FILE=/usr/share/qrb_ros_colorspace_convert/config/large_message_profile.xml
Copy to clipboard
2. Run the sample `qrb-ros-color-space-convert`.
# If you want to convert color space from NV12 to RGB888, run the command below
(ssh) ros2 launch qrb_ros_colorspace_convert colorspace_convert.launch.py 'conversion_type:=nv12_to_rgb8' 'latency_fps_test:=False'
# If you want to convert color space from RGB888 to NV12, run the command below
(ssh) ros2 launch qrb_ros_colorspace_convert colorspace_convert.launch.py 'conversion_type:=rgb8_to_nv12' 'latency_fps_test:=False'
Copy to clipboard
**Result**
Use the following command to confirm the color space conversion Result.
>
>
> (ssh) ros2 topic echo /image_raw | grep "encoding"
> (ssh) ros2 topic echo /image | grep "encoding"
> Copy to clipboard
## Build and run `qrb-ros-color-space-convert`
**Steps**
1. Build the sample project.
# Set up the QIR SDK environment
tar -zxf qirp-sdk_.tar.gz
cd /qirp-sdk
rm ~/.bash_aliases
source setup.sh
# build the sample application
cd /qirp-samples/platform/sample_colorspace_convert
colcon build --merge-install --cmake-args ${CMAKE_ARGS}
Copy to clipboard
2. Package and push the sample application to the device.
cd /qirp-samples/platform/sample_colorspace_convert/install
tar -czvf sample_colorspace_convert.tar.gz lib share
scp sample_colorspace_convert.tar.gz root@[ip-addr]:/opt/
Copy to clipboard
3. To sign in to the device, use the command ssh root@[ip-addr].
ssh root@[ip-addr]
Copy to clipboard
4. Install the sample package and model package.
# Remount the /usr directory with read-write permissions
(ssh) mount -o remount rw /usr
# Install sample package
(ssh) tar --no-same-owner -zxf /opt/sample_colorspace_convert.tar.gz -C /usr/
Copy to clipboard
5. Set up the runtime environment.
Value range of `ROS_DOMAIN_ID`: [0, 232]
# Set the HOME variable
(ssh) export HOME=/opt
# Set up the runtime environment
(ssh) source /usr/share/qirp-setup.sh
(ssh) export ROS_DOMAIN_ID=xx
# Set up the Weston environment
(ssh) export XDG_RUNTIME_DIR=/dev/socket/weston/
(ssh) mkdir -p $XDG_RUNTIME_DIR
(ssh) export WAYLAND_DISPLAY=wayland-1
# Set up the shared memory
(ssh) export FASTRTPS_DEFAULT_PROFILES_FILE=/usr/share/qrb_ros_colorspace_convert/config/large_message_profile.xml
Copy to clipboard
6. Run the sample application according to [Run out-of-the-box qrb-ros-color-space-convert](https://docs.qualcomm.com/doc/80-70020-265/topic/qrb-ros-color-space-convert_5_2_9.html#run-out-of-the-box-qrb-ros-color-space-convert).
Last Published: Oct 10, 2025
[Previous Topic
OCR-service](https://docs.qualcomm.com/bundle/publicresource/80-70020-265/topics/ocr-service_5_2_7.md) [Next Topic
QRB-ROS-camera](https://docs.qualcomm.com/bundle/publicresource/80-70020-265/topics/qrb-ros-camera.md)