0
$\begingroup$

Rosanswers logo

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?


Originally posted by Daniel Canelhas on ROS Answers with karma: 465 on 2012-04-16

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by Daniel Canelhas with karma: 465 on 2012-04-16

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.