ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

cv::bilateralFilter segfaults on image from cv_bridge

asked 2012-04-16 03:15:02 -0600

Daniel Canelhas gravatar image

updated 2016-10-24 09:09:57 -0600

ngrennan gravatar image

I have a ROS node that takes in a depth image and converts it to an openCV compatible format. However it doesn't seem to be compatible with all openCV functions.

cv_bridge::CvImagePtr bridge;
    bridge = cv_bridge::toCvCopy(msg, "32FC1");
catch (cv_bridge::Exception& e)
    ROS_ERROR("Failed to transform depth image.");
depthImage = bridge->image;
cv::Mat depthImageFiltered(480,640,CV_32F);
cv::bilateralFilter( depthImage, depthImageFiltered, -1, 0.45, 3.0 );

This produces a segmentation fault on the last line whereas

cv::blur( depthImage, depthImageFiltered, cv::Size(5,5));

works without error. I see no reason why these two should behave differently. Weirder still, the bilateralFilter works fine with floating-point images loaded through cv::imread(). What am I doing wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-04-16 05:09:35 -0600

Daniel Canelhas gravatar image

Apparently what seems to cause the error is the presence of NaN's in the image.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools


Asked: 2012-04-16 03:15:02 -0600

Seen: 794 times

Last updated: Apr 16 '12