ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Can't get zbar_ros to recognize QR code

asked 2017-03-12 19:35:04 -0600

lmm1910 gravatar image


Beginner here -- I am trying to use zbar_ros to read a qr code using my laptop's webcam. It doesn't seem to be able to subscribe to the /image topic and /barcode_reader isn't subscribed to anything. I am using Ubuntu 14.04 and ROS indigo. Any thoughts on what I am missing?

My launch file: <launch>

<node pkg="nodelet" type="nodelet" name="zbar_manager"  args="manager"/>

<!-- Example camera launch -->
<node pkg="nodelet" type="nodelet" name="uvc_camera" args="load uvc_camera/CameraNodelet zbar_manager">
    <remap from="image_raw" to="image"/>
<param name="device" type="string" value="/dev/video0"/>

<!--<node pkg="nodelet" type="nodelet" name="barcode_reader" args="load zbar_ros/barcode_reader_nodelet zbar_manager">-->
    <!--<param name="throttle_repeated_barcodes" type="double" value="2.0"/>-->

<node pkg="zbar_ros" type="barcode_reader_node" name="barcode_reader">
    <param name="throttle_repeated_barcodes" type="double" value="2.0"/>


$roslaunch zbar_ros customlaunch.launch


 * /barcode_reader/throttle_repeated_barcodes: 2.0
 * /rosdistro: indigo
 * /rosversion: 1.11.20
 * /uvc_camera/device: /dev/video0

    barcode_reader (zbar_ros/barcode_reader_node)
    uvc_camera (nodelet/nodelet)
    zbar_manager (nodelet/nodelet)


core service [/rosout] found
process[zbar_manager-1]: started with pid [6111]
process[uvc_camera-2]: started with pid [6112]
process[barcode_reader-3]: started with pid [6113]

$ rosnode info /barcode_reader

Node [/barcode_reader]
 * /rosout [rosgraph_msgs/Log]
 * /barcode [std_msgs/String]

Subscriptions: None

 * /barcode_reader/get_loggers
 * /barcode_reader/set_logger_level
 * /barcode_reader/load_nodelet
 * /barcode_reader/unload_nodelet
 * /barcode_reader/list

contacting node ...
Pid: 6113
 * topic: /rosout
    * to: /rosout
    * direction: outbound
    * transport: TCPROS
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-03-13 04:33:32 -0600

Cees gravatar image

What is good to know about zbar_ros is that it only subscribes to the image topic when you start listening on its output topic (relevant function in zbar_ros source). As soon as you run rostopic echo /barcode, you will see a notification that zbar_ros subscribes to the image topic.

As a sidenote: in my setup I did the remap on the zbar_ros side, instead of the camera side. Not sure if that is relevant.

edit flag offensive delete link more


Thanks! I think the issue may be with camera calibration since I can read bar codes at a certain length, but not QR codes.

lmm1910 gravatar image lmm1910  ( 2017-03-18 14:41:12 -0600 )edit

If you are able to read some barcodes, you should see the connection between zbar_ros and your image topic in rqt_graph. As for your problem: Are you sure your QR code is not mirrored? Zbar cannot handle that.

Cees gravatar image Cees  ( 2017-03-19 05:04:06 -0600 )edit

Question Tools



Asked: 2017-03-12 19:35:04 -0600

Seen: 894 times

Last updated: Mar 13 '17