added special function to patch NaN's in image. call this function from bilateralfilter (should fix bug #1811)

This commit is contained in:
Vadim Pisarevsky
2012-04-24 15:16:21 +00:00
parent 47ee844df6
commit 866d8c0cfa
3 changed files with 26 additions and 0 deletions

View File

@@ -2186,6 +2186,28 @@ bool checkRange(InputArray _src, bool quiet, Point* pt, double minVal, double ma
}
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);