//! checks that each matrix element is within the specified range.
CV_EXPORTS_W bool checkRange(InputArray a, bool quiet=true, CV_OUT Point* pos=0,
double minVal=-DBL_MAX, double maxVal=DBL_MAX);
+//! converts NaN's to the given number
+CV_EXPORTS_W void patchNaNs(InputOutputArray a, double val=0);
+
//! implements generalized matrix product algorithm GEMM from BLAS
CV_EXPORTS_W void gemm(InputArray src1, InputArray src2, double alpha,
InputArray src3, double gamma, OutputArray dst, int flags=0);
}
+void patchNaNs( InputOutputArray _a, double _val )
+{
+ Mat a = _a.getMat();
+ CV_Assert( a.depth() == CV_32F );
+
+ const Mat* arrays[] = {&a, 0};
+ int* ptrs[1];
+ NAryMatIterator it(arrays, (uchar**)ptrs);
+ size_t len = it.size*a.channels();
+ Cv32suf val;
+ val.f = (float)_val;
+
+ for( size_t i = 0; i < it.nplanes; i++, ++it )
+ {
+ int* tptr = ptrs[0];
+ for( size_t j = 0; j < len; j++ )
+ if( (tptr[j] & 0x7fffffff) > 0x7f800000 )
+ tptr[j] = val.i;
+ }
+}
+
+
void exp(const float* src, float* dst, int n)
{
Exp_32f(src, dst, n);
// temporary copy of the image with borders for easy processing
Mat temp;
copyMakeBorder( src, temp, radius, radius, radius, radius, borderType );
+ patchNaNs(temp);
// allocate lookup tables
vector<float> _space_weight(d*d);