compressed_image_transport segmentation fault
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/T... unmodified.
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?
gdb says it comes from opencv "cv::imdecode(....) " Is it somehow not recognizing the decompressed image?
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.
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.