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

No image display window in cv_bridge tutorial. (Does compressed image matter?

asked 2014-05-29 04:28:43 -0500

updated 2014-05-30 01:47:41 -0500


I'm following the cv_bridge tutorial

The code is correct(I just copy the code and change the topic name to mine /camera/image ), also modified the CMakeLists.xml.

The catkin_build is successful without error.

But when I run the node, there is nothing showed up.

The node should run up successfully because new topics show up.


Also I can view the image using image_view

rosrun image_view image_view image:=/camera/image _image_transport:=compressed

I'm afraid maybe the compressed video matters so I change add the command when running:

$ rosparam set /compressed_listener/image_transport compressed
$ rosrun mypackage mynode __name:=compressed_listener

But still no display window...


edit retag flag offensive close merge delete


Are any images published on the /image_converter/output_video topic? You should be able to verify that images are being published with

rostopic hz
rostopic echo

ahendrix gravatar image ahendrix  ( 2014-05-30 12:29:55 -0500 )edit

@ahendrix nothing... I ran `rostopic echo /image_converter/output_video` but got nothing. I think the subscribe of video topic failed.

lanyusea gravatar image lanyusea  ( 2014-05-30 13:50:33 -0500 )edit

I guess maybe the image_transport matters because when I subscribe I just use the code `image_sub_ = it_.subscribe("/camera/image", 1, &ImageConverter::imageCb, this);` while for image_view, I need to set `_image_transport=compressed` to see the video. But I don't know what to change here...

lanyusea gravatar image lanyusea  ( 2014-05-30 13:51:20 -0500 )edit

@ahendrix Thanks so much! it works, but could you teach me how to find the parameter need to remap? first I searched the source and wiki of image_transport and cv_bridge with key work`compressed`, but I got nothing... I really want to know how to get the answer when I face that kind of problem

lanyusea gravatar image lanyusea  ( 2014-05-31 09:20:46 -0500 )edit

to be honest, I'm not sure what the appropriate parameter to change here is. I suspect it's namespaced to the topic name, but I'd have to read the source for image_transport to really understand it.

ahendrix gravatar image ahendrix  ( 2014-06-02 15:19:12 -0500 )edit

@ahendrix Thanks again, I read the document again and now I can understand it much better. Also, could you convert it into the answer so I can mark it as the correct one.

lanyusea gravatar image lanyusea  ( 2014-06-03 04:06:38 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2014-05-30 14:21:18 -0500

ahendrix gravatar image

updated 2014-06-03 04:18:11 -0500

Try constructing your listener with the extra argument specifying the transport hint:

image_sub_ = it_.subscribe("/camera/image", 1, &ImageConverter::imageCb, this, image_transport::TransportHints("compressed"));
edit flag offensive delete link more

answered 2014-05-29 09:03:48 -0500

Hamid Didari gravatar image

updated 2014-05-29 09:07:55 -0500

in example code change:

#include <image_transport/image_transport.h>


#include <sensor_msgs/image.h>

and also change :

void imageCb(const sensor_msgs::ImageConstPtr& msg)


void imageCb(const sensor_msgs::Image &msg)
edit flag offensive delete link more


Hi, I tried this but the catkin_make cannot find the `image.h` file. The `sensor_msgs` package is included successfully but there seems no image.h inside... also, if I remove the `<image_transport image_transport.h="">`, will there be any error since there are some variable in type ` image_transport::`

lanyusea gravatar image lanyusea  ( 2014-05-30 01:37:54 -0500 )edit

write this command in terminal $rospack depends1 (your pakage name) . could you see sensor_msgs?

Hamid Didari gravatar image Hamid Didari  ( 2014-05-30 02:51:17 -0500 )edit

yes there is. also I can include sensor_msgs/image_encodings.h as the tutorial say, but not sensor_msgs/image.h .I'm using hydro

lanyusea gravatar image lanyusea  ( 2014-05-30 03:15:22 -0500 )edit

Question Tools

1 follower


Asked: 2014-05-29 04:28:43 -0500

Seen: 1,396 times

Last updated: Jun 03 '14