fixed a few compile warnings and errors with VS2010.

This commit is contained in:
Vadim Pisarevsky 2012-08-03 17:12:45 +04:00
parent 5b4297cccf
commit 9c0f556d88
2 changed files with 20 additions and 21 deletions

View File

@ -1292,22 +1292,22 @@ class BilateralFilter_8u_Invoker :
public ParallelLoopBody public ParallelLoopBody
{ {
public: public:
BilateralFilter_8u_Invoker(const Mat &_src, Mat& _dst, Mat _temp, int _radius, int _maxk, BilateralFilter_8u_Invoker(Mat& _dest, const Mat& _temp, int _radius, int _maxk,
int* _space_ofs, float *_space_weight, float *_color_weight) : int* _space_ofs, float *_space_weight, float *_color_weight) :
ParallelLoopBody(), src(_src), dst(_dst), temp(_temp), radius(_radius), ParallelLoopBody(), dest(&_dest), temp(&_temp), radius(_radius),
maxk(_maxk), space_ofs(_space_ofs), space_weight(_space_weight), color_weight(_color_weight) maxk(_maxk), space_ofs(_space_ofs), space_weight(_space_weight), color_weight(_color_weight)
{ {
} }
virtual void operator() (const Range& range) const virtual void operator() (const Range& range) const
{ {
int i, j, cn = src.channels(), k; int i, j, cn = dest->channels(), k;
Size size = src.size(); Size size = dest->size();
for( i = range.start; i < range.end; i++ ) for( i = range.start; i < range.end; i++ )
{ {
const uchar* sptr = temp.data + (i+radius)*temp.step + radius*cn; const uchar* sptr = temp->ptr(i+radius) + radius*cn;
uchar* dptr = dst.data + i*dst.step; uchar* dptr = dest->ptr(i);
if( cn == 1 ) if( cn == 1 )
{ {
@ -1353,9 +1353,9 @@ public:
} }
private: private:
const Mat& src; const Mat *temp;
Mat &dst, temp; Mat *dest;
int radius, maxk, * space_ofs; int radius, maxk, *space_ofs;
float *space_weight, *color_weight; float *space_weight, *color_weight;
}; };
@ -1412,7 +1412,7 @@ bilateralFilter_8u( const Mat& src, Mat& dst, int d,
space_ofs[maxk++] = (int)(i*temp.step + j*cn); space_ofs[maxk++] = (int)(i*temp.step + j*cn);
} }
BilateralFilter_8u_Invoker body(src, dst, temp, radius, maxk, space_ofs, space_weight, color_weight); BilateralFilter_8u_Invoker body(dst, temp, radius, maxk, space_ofs, space_weight, color_weight);
parallel_for_(Range(0, size.height), body); parallel_for_(Range(0, size.height), body);
} }
@ -1423,22 +1423,21 @@ class BilateralFilter_32f_Invoker :
public: public:
BilateralFilter_32f_Invoker(int _cn, int _radius, int _maxk, int *_space_ofs, BilateralFilter_32f_Invoker(int _cn, int _radius, int _maxk, int *_space_ofs,
Mat _temp, Mat *_dest, Size _size, const Mat& _temp, Mat& _dest, float _scale_index, float *_space_weight, float *_expLUT) :
float _scale_index, float *_space_weight, float *_expLUT) :
ParallelLoopBody(), cn(_cn), radius(_radius), maxk(_maxk), space_ofs(_space_ofs), ParallelLoopBody(), cn(_cn), radius(_radius), maxk(_maxk), space_ofs(_space_ofs),
temp(_temp), dest(_dest), size(_size), scale_index(_scale_index), space_weight(_space_weight), expLUT(_expLUT) temp(&_temp), dest(&_dest), scale_index(_scale_index), space_weight(_space_weight), expLUT(_expLUT)
{ {
} }
virtual void operator() (const Range& range) const virtual void operator() (const Range& range) const
{ {
Mat& dst = *dest;
int i, j, k; int i, j, k;
Size size = dest->size();
for( i = range.start; i < range.end; i++ ) for( i = range.start; i < range.end; i++ )
{ {
const float* sptr = (const float*)(temp.data + (i+radius)*temp.step) + radius*cn; const float* sptr = temp->ptr<float>(i+radius) + radius*cn;
float* dptr = (float*)(dst.data + i*dst.step); float* dptr = dest->ptr<float>(i);
if( cn == 1 ) if( cn == 1 )
{ {
@ -1490,8 +1489,8 @@ public:
private: private:
int cn, radius, maxk, *space_ofs; int cn, radius, maxk, *space_ofs;
Mat temp, *dest; const Mat* temp;
Size size; Mat *dest;
float scale_index, *space_weight, *expLUT; float scale_index, *space_weight, *expLUT;
}; };
@ -1581,7 +1580,7 @@ bilateralFilter_32f( const Mat& src, Mat& dst, int d,
// parallel_for usage // parallel_for usage
BilateralFilter_32f_Invoker body(cn, radius, maxk, space_ofs, temp, &dst, size, scale_index, space_weight, expLUT); BilateralFilter_32f_Invoker body(cn, radius, maxk, space_ofs, temp, dst, scale_index, space_weight, expLUT);
parallel_for_(Range(0, size.height), body); parallel_for_(Range(0, size.height), body);
} }

View File

@ -90,8 +90,8 @@ namespace cvtest
int CV_BilateralFilterTest::getRandInt(RNG& rng, int min_value, int max_value) const int CV_BilateralFilterTest::getRandInt(RNG& rng, int min_value, int max_value) const
{ {
double rand_value = rng.uniform(log(min_value), log(max_value + 1)); double rand_value = rng.uniform(log((double)min_value), log((double)max_value + 1));
return cvRound(exp(rand_value)); return cvRound(exp((double)rand_value));
} }
void CV_BilateralFilterTest::reference_bilateral_filter(const Mat &src, Mat &dst, int d, void CV_BilateralFilterTest::reference_bilateral_filter(const Mat &src, Mat &dst, int d,