OpenCV error 'CAIRO_STATUS_SUCCESS failed' under ROS. Bug? [closed]

asked 2013-08-22 03:31:22 -0500

Huibuh gravatar image

updated 2014-04-20 14:09:44 -0500

ngrennan gravatar image

Dear fellow ROS developers,

I have encountered an OpenCV related bug that causes a crash when run in the context of ROS bindings.

My setup:

  • Ubuntu 12.04
  • ROS Groovy Desktop, up-to-date, which contains the following binary apt packages:
    • ros-groovy-vision-opencv
    • opencv ros-groovy-opencv2

My self written catkin-based ROS node has the following dependencies specified in its CMakeLists.txt:

find_package(catkin REQUIRED COMPONENTS cv_bridge ...)
find_package(OpenCV REQUIRED)
...
include_directories(include
  ${catkin_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
)

Through debugging I figured out which call actually causes the crash. Somewhere in my code I call:

cvFindContours(...)

the resulting error message is:

opencv_ros_node: /build/buildd/cairo-1.10.2/src/cairo-surface.c:1287: cairo_surface_set_device_offset: Assertion `status == CAIRO_STATUS_SUCCESS' failed.

The same code works if it is compiled stand alone, without any ROS bindings/includes, using a self-compiled version of OpenCV. However, if I link the stand alone build against the OpenCV installation that come with ROS, I get the same error.

I have spent many hours trying to resolve this issue, but no luck so far. Here is a link where someone else encounters the same error:

http://answers.opencv.org/question/14394/findcontours-error-with-cairo/

I also tried what is described in here http://answers.ros.org/question/61923/how-to-use-newer-versions-of-opencv-in-fuerte/ and here http://answers.ros.org/question/47249/problem-with-using-opencv_gpu-inside-ros/ without luck.

Any help would be appreciated.

Regards,

Heiko

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2017-11-30 13:23:35.251987

Comments

Hi I believe I have the same issue, although I haven't tested it stand alone with OpenCV and not ROS. I tried removing any calls to cv::waitKey and cv::imshow from my code and this at least superficially resolved the issue. I assume it is a concurrency issue of some sort.

NickT gravatar image NickT  ( 2013-09-02 23:55:11 -0500 )edit

Hello Nick, I will try the same on Monday and post back whether it also resolved my issue. Thanks for the tip!

Huibuh gravatar image Huibuh  ( 2013-09-15 00:14:19 -0500 )edit

Hm, when I do this (remove waitkey) no windows show up. (Since waitkey calls imshow, this may make sense). But I can't tell if FindContours is working, then.

KevinNickels gravatar image KevinNickels  ( 2013-09-30 09:12:10 -0500 )edit

Hello Kevin, Im my case, uncommenting cv::waitKey and cv::imshow did not do the trick - same crash, same error message. However, I am convinced now that this, at least in my case with ROS running at the same time, must be a concurrency issue. I tried to debug using gdb and other tools, but to no avail. This also explains while my code runs fine stand-alone, i,e, without being executed as part of a ROS node. If anyone can give me any hints on how I could get to the bottom of this and come up with a fix, that would be highly appreciated!

Huibuh gravatar image Huibuh  ( 2013-09-30 22:06:31 -0500 )edit