Ask Your Question
0

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

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

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

Hi,

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.

/camera/camera_info
/camera/image
/camera/image/compressed
/image_converter/output_video
/image_converter/output_video/compressed
/image_converter/output_video/compressed/parameter_descriptions
/image_converter/output_video/compressed/parameter_updates
/image_converter/output_video/compressedDepth
/image_converter/output_video/compressedDepth/parameter_descriptions
/image_converter/output_video/compressedDepth/parameter_updates
/image_converter/output_video/theora
/image_converter/output_video/theora/parameter_descriptions
/image_converter/output_video/theora/parameter_updates
/rosout
/rosout_agg

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

http://wiki.ros.org/image_transport/T...

But still no display window...

Thanks

edit retag flag offensive close merge delete

Comments

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
or
rostopic echo

ahendrix gravatar image ahendrix  ( 2014-05-30 12:29:55 -0600 )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 -0600 )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 -0600 )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 -0600 )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 -0600 )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 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
2

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

ahendrix gravatar image

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

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
0

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

Hamid Didari gravatar image

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

in example code change:

#include <image_transport/image_transport.h>

to

#include <sensor_msgs/image.h>

and also change :

void imageCb(const sensor_msgs::ImageConstPtr& msg)

to:

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

Comments

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 -0600 )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 -0600 )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 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 1,259 times

Last updated: Jun 03 '14