ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

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;
try
{
    bridge = cv_bridge::toCvCopy(msg, "32FC1");
}
catch (cv_bridge::Exception& e)
{
    ROS_ERROR("Failed to transform depth image.");
    return;
}
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
0

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

Question Tools

Stats

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

Seen: 886 times

Last updated: Apr 16 '12