Ask Your Question

cv::bilateralFilter segfaults on image from cv_bridge

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

Daniel Canelhas gravatar image

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

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 -0500

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 -0500

Seen: 727 times

Last updated: Apr 16 '12