diff --git a/modules/cudaimgproc/src/cuda/bilateral_filter.cu b/modules/cudaimgproc/src/cuda/bilateral_filter.cu index f81adc7a9..c077a833f 100644 --- a/modules/cudaimgproc/src/cuda/bilateral_filter.cu +++ b/modules/cudaimgproc/src/cuda/bilateral_filter.cu @@ -98,6 +98,8 @@ namespace cv { namespace cuda { namespace device continue; value_type value = saturate_cast(src(cy, cx)); + if (isnan(norm_l1(value))) + continue; float weight = ::exp(space2 * sigma_spatial2_inv_half + sqr(norm_l1(value - center)) * sigma_color2_inv_half); sum1 = sum1 + weight * value; @@ -114,6 +116,8 @@ namespace cv { namespace cuda { namespace device continue; value_type value = saturate_cast(b.at(cy, cx, src.data, src.step)); + if (isnan(norm_l1(value))) + continue; float weight = ::exp(space2 * sigma_spatial2_inv_half + sqr(norm_l1(value - center)) * sigma_color2_inv_half);