Skip to main content
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. pipeline

Figure : ocr_service pipeline

ROS nodes used in the ocr_service pipeline

ROS topics used in the ocr_service pipeline

ROS topicMessage typePublished/Subscribed byDescription
/image_topic_name<sensor_msgs.msg.Image>Subscribe to images from other nodesThe image to be processed.
/ocr_image_topic_name<std_msgs.msg.String>Published by ocr-rosnodePublishes the OCR result.

Prerequisites

You have Set up the device according to Set up the environment for running sample applications.

Run out-of-the-box ocr_service

1

Set up QIR SDK and ROS2 environment on the device

Start three terminals, and run the following commands in each terminal.Value range of ROS_DOMAIN_ID: [0, 232]
SSH Session
2

Launch ocr_server

In terminal 1, launch ocr_server.
SSH Session
3

Push an image and run ocr_testnode

In terminal 2, push an image to the device and run the ocr_testnode.
SSH Session
4

Run ocr_client

In terminal 3, run the ocr_client.
SSH Session
You will see the following log:result

Build and run ocr_service

1

Build ocr_msg and ocr_service on the host

2

Push ocr_msg and ocr_service to the device

SSH Session
3

Run ocr_service

Run ocr_service on the device with the steps in Run out-of-the-box ocr_service.