0
$\begingroup$

Rosanswers logo

On Ubuntu, I wrote a simple subscriber and display with cv::imshow. It works with raw image, but if I set the image_transport param to "compressed" it immediately gives segmentation fault. I am guessing that it has something to do with cvbridge::toCvShare not decoding the compressed image correctly or somehow not compatible with opencv. Is there a fix? Thank you.

gbd response: Program received signal SIGSEGV, Segmentation fault. 0x00007ffff79a036c in cv::imdecode(cv::_InputArray const&, int) () from /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4 (gdb)

#0  0x00007ffff79a036c in cv::imdecode(cv::_InputArray const&, int) ()
   from /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4
#1  0x00007fffd15174d7 in ?? ()
   from /opt/ros/indigo/lib//libcompressed_image_transport.so
#2  0x00007fffd151914c in ?? ()
   from /opt/ros/indigo/lib//libcompressed_image_transport.so
#3  0x00007fffd151c1d0 in ?? ()
   from /opt/ros/indigo/lib//libcompressed_image_transport.so
#4  0x00007ffff74bf9c5 in ros::SubscriptionQueue::call() ()
   from /opt/ros/indigo/lib/libroscpp.so
#5  0x00007ffff747d777 in ros::CallbackQueue::callOneCB(ros::CallbackQueue::TLS*) () from /opt/ros/indigo/lib/libroscpp.so
#6  0x00007ffff747e583 in ros::CallbackQueue::callAvailable(ros::WallDuration)
    () from /opt/ros/indigo/lib/libroscpp.so
#7  0x00007ffff74c24e5 in ros::SingleThreadedSpinner::spin(ros::CallbackQueue*)
    () from /opt/ros/indigo/lib/libroscpp.so
#8  0x00007ffff74aaaeb in ros::spin() () from /opt/ros/indigo/lib/libroscpp.so
#9  0x0000000000407369 in main (argc=1, argv=0x7fffffffd9d8)
    at /home/ethan/camera/src/camera_reader/src/reader.cpp:27



source code is http://wiki.ros.org/image_transport/Tutorials/SubscribingToImages unmodified.


Originally posted by meeple on ROS Answers with karma: 1 on 2016-03-06

Post score: 0


Original comments

Comment by ahendrix on 2016-03-07:
image_transport should have already decompressed the image before it's ever passed into your callback. Have you tried running your node in a debugger to figure out where the segfault is occurring?

Comment by meeple on 2016-03-07:
gdb says it comes from opencv "cv::imdecode(....) " Is it somehow not recognizing the decompressed image?

Comment by ahendrix on 2016-03-07:
That's strange. Can you edit your question to include your subscriber code (or a simplified version that still exhibits this issue), and the gdb backtrace that you get? Please use the "Preformatted Text (101010)" button when formatting source code, so that it's easily readable.

Comment by ahendrix on 2016-03-07:
This looks like a bug. When the program finishes in gdb, please run the backtrace command to get a full stack trace of the crash location.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The stacktrace that you've posted is clearly not in your code. Therefore, this looks like a bug in the image transport library.

You should record a short bag file with the image topics in question, and verify that you can reproduce this issue by playing back the bag file with the example code running.

Once you're able to reproduce the issue with a small bag file and the sample program, you should open a ticket against the image_transport bug tracker. Be sure to include the versions of image_transport, ROS, OpenCV and Ubuntu that you're using.

Keeping the bag file small will make it quicker and easier for the package maintainer to download it and reproduce your issue.


Originally posted by ahendrix with karma: 47576 on 2016-03-07

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.