cv::bilateralFilter assertion fails with 3-channel float

Hi all! Really hoping to get some help with this issue.

I have an image cv::Mat that contains a 3-channel floating point image buffer and I’d like to run cv::bilateralFilter, however I’m getting an issue with a debug assertion in bilateral_filter.simd.hpp line 993

CV_DbgAssert(fabs(wsum(j) >= 0);

I can’t figure out why this assertion is failing, especially since presumably it checks if the absolute value of a float is >0?

I’d really like to use bilateralFilter here, especially since most of the other filter types (median, etc…) require 8-bit images but we are trying to preserve as much data integrity as possible at this stage.

If you have any advice it would be greatly appreciated!!!

related: c++ - OpenCV 4.5 Error: Assertion failed (fabs(wsum[j]) >= 0) in cv::opt_AVX2::`anonymous-namespace'::BilateralFilter_32f_Invoker::operator - Stack Overflow

1 Like

Update from the team for posterity:

Some of the float values in our image matrix were nan’s after being divided by inf in another image processing steps. fabs(nan) is not greater than 0. It sounds like they will be able to solve the rest of the problems from there