# Run basic OCR with `ocr_service`
The `ocr_service` sample application enables a service that provides the Optical Character Recognition (OCR) function.
It captures the image topic from the ROS system and publishes the result with the `ocr_topic`.
## Pipeline flow for `ocr_service`
This figure shows the basic messages and data transfer channels, with the relevant client/server and ROS node.
**Figure : `ocr_service` pipeline**
## ROS nodes used in the `ocr_service` pipeline
| ROS node | Description |
| --- | --- |
| `OCR_CLIENT` | Sends the OCR request to `ocr_server` and gets the server result. |
| `OCR_SERVER` | Gets the OCR request from `ocr_server` , and forks the `ocr_rosnode` according to the request. |
| `OCR_ROSNODE` | Subscribes to the image topic according to the request. |
## ROS topics used in the `ocr_service` pipeline
| ROS topic | Message type | Published/Subscribed by | Description |
| --- | --- | --- | --- |
| `/image_topic_name` | `` | Subscribe to images from other nodes | The image to be processed. |
| `/ocr_image_topic_name` | `` | Published by `ocr-rosnode` | Publishes the OCR result. |
## Prerequisites
You have **Set up the device** according to [Set up the environment for running sample applications](https://docs.qualcomm.com/doc/80-70030-265/topic/quick_start.html#setup-demo-qs).
## Run out-of-the-box `ocr_service`
**Steps**
1. Start three terminals, and run the following commands in each terminal to set up QIR SDK and ROS2 environment on the device.
Value range of `ROS_DOMAIN_ID`: [0, 232]
ssh root@[ip-addr]
(ssh) mount -o remount,rw /usr
(ssh) source /usr/share/qirp-setup.sh
(ssh) export ROS_DOMAIN_ID=xx
Copy to clipboard
2. In terminal 1, launch `ocr_server`.
(ssh) ros2 run ocr_service ocr_server
Copy to clipboard
3. In terminal 2, push an image to the device and run the
`ocr_testnode`.
scp qirp-samples/platform/ocr_service/scripts/digital_720p.png root@[ip-addr]:/opt
(ssh) ros2 run ocr_service ocr_testnode --topic imagetest --picture /opt/digital_720p.png
Copy to clipboard
4. In terminal 3, run the `ocr_client`.
(ssh) ros2 run ocr_service ocr_client imagetest
Copy to clipboard
You will see the following log:

## Build and run `ocr_service`
**Steps**
1. Build `ocr_msg` and `ocr_service` provided by the QIR SDK on the host.
cd
source setup.sh
cd qirp-samples/platform/ocr_service
colcon build --merge-install --cmake-args ${CMAKE_ARGS}
Copy to clipboard
2. Push `ocr_msg` and `ocr_service` to the device.
cd qirp-samples/platform/ocr_service/install
tar -zcvf ocr_service.tar.gz include/ lib/ share/
ssh root@[ip-addr]
(ssh) mount -o remount rw /
scp ocr_service.tar.gz root@[ip-addr]:/opt
ssh ssh root@[ip-addr]
(ssh) tar --no-overwrite-dir --no-same-owner -zxf /opt/ocr_service.tar.gz -C /usr/
scp qirp-samples/platform/ocr_service/scripts/digital_720p.png root@[ip-addr]:/opt
Copy to clipboard
3. Run `ocr_service` on the device with the steps in [Run out-of-the-box ocr\_service](https://docs.qualcomm.com/doc/80-70030-265/topic/ocr-service_5_2_7.html#id-case1-ocr).
Last Published: Jul 23, 2026
[Previous Topic
Publish system status with qrb\_ros\_system\_monitor](https://docs.qualcomm.com/bundle/publicresource/80-70030-265/topics/qrb-ros-system-monitor_5_2_6.md) [Next Topic
Run a zero-copy camera with qrb\_ros\_camera](https://docs.qualcomm.com/bundle/publicresource/80-70030-265/topics/qrb-ros-camera.md)