mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-21 06:11:09 +08:00
Some changes to make VS2010 compiler happy.
This commit is contained in:
@@ -92,12 +92,12 @@ void MakeArtificialExample(UMat &dst_frame1, UMat &dst_frame2)
|
|||||||
int OF_scale = 6;
|
int OF_scale = 6;
|
||||||
double sigma = dst_frame1.cols / 300;
|
double sigma = dst_frame1.cols / 300;
|
||||||
|
|
||||||
UMat tmp(Size(dst_frame1.cols / (int)pow(2, src_scale), dst_frame1.rows / (int)pow(2, src_scale)), CV_8U);
|
UMat tmp(Size(dst_frame1.cols / (1 << src_scale), dst_frame1.rows / (1 << src_scale)), CV_8U);
|
||||||
randu(tmp, 0, 255);
|
randu(tmp, 0, 255);
|
||||||
resize(tmp, dst_frame1, dst_frame1.size(), 0.0, 0.0, INTER_LINEAR);
|
resize(tmp, dst_frame1, dst_frame1.size(), 0.0, 0.0, INTER_LINEAR);
|
||||||
resize(tmp, dst_frame2, dst_frame2.size(), 0.0, 0.0, INTER_LINEAR);
|
resize(tmp, dst_frame2, dst_frame2.size(), 0.0, 0.0, INTER_LINEAR);
|
||||||
|
|
||||||
Mat displacement_field(Size(dst_frame1.cols / (int)pow(2, OF_scale), dst_frame1.rows / (int)pow(2, OF_scale)),
|
Mat displacement_field(Size(dst_frame1.cols / (1 << OF_scale), dst_frame1.rows / (1 << OF_scale)),
|
||||||
CV_32FC2);
|
CV_32FC2);
|
||||||
randn(displacement_field, 0.0, sigma);
|
randn(displacement_field, 0.0, sigma);
|
||||||
resize(displacement_field, displacement_field, dst_frame2.size(), 0.0, 0.0, INTER_CUBIC);
|
resize(displacement_field, displacement_field, dst_frame2.size(), 0.0, 0.0, INTER_CUBIC);
|
||||||
|
@@ -86,12 +86,12 @@ void MakeArtificialExample(Mat &dst_frame1, Mat &dst_frame2)
|
|||||||
int OF_scale = 6;
|
int OF_scale = 6;
|
||||||
double sigma = dst_frame1.cols / 300;
|
double sigma = dst_frame1.cols / 300;
|
||||||
|
|
||||||
Mat tmp(Size(dst_frame1.cols / (int)pow(2, src_scale), dst_frame1.rows / (int)pow(2, src_scale)), CV_8U);
|
Mat tmp(Size(dst_frame1.cols / (1 << src_scale), dst_frame1.rows / (1 << src_scale)), CV_8U);
|
||||||
randu(tmp, 0, 255);
|
randu(tmp, 0, 255);
|
||||||
resize(tmp, dst_frame1, dst_frame1.size(), 0.0, 0.0, INTER_LINEAR);
|
resize(tmp, dst_frame1, dst_frame1.size(), 0.0, 0.0, INTER_LINEAR);
|
||||||
resize(tmp, dst_frame2, dst_frame2.size(), 0.0, 0.0, INTER_LINEAR);
|
resize(tmp, dst_frame2, dst_frame2.size(), 0.0, 0.0, INTER_LINEAR);
|
||||||
|
|
||||||
Mat displacement_field(Size(dst_frame1.cols / (int)pow(2, OF_scale), dst_frame1.rows / (int)pow(2, OF_scale)),
|
Mat displacement_field(Size(dst_frame1.cols / (1 << OF_scale), dst_frame1.rows / (1 << OF_scale)),
|
||||||
CV_32FC2);
|
CV_32FC2);
|
||||||
randn(displacement_field, 0.0, sigma);
|
randn(displacement_field, 0.0, sigma);
|
||||||
resize(displacement_field, displacement_field, dst_frame2.size(), 0.0, 0.0, INTER_CUBIC);
|
resize(displacement_field, displacement_field, dst_frame2.size(), 0.0, 0.0, INTER_CUBIC);
|
||||||
|
@@ -570,7 +570,7 @@ bool GPCTree::trainNode( size_t nodeId, SIter begin, SIter end, unsigned depth )
|
|||||||
localBestScore = score;
|
localBestScore = score;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const double beta = simulatedAnnealingTemperatureCoef * std::sqrt( i ) / ( nSamples * ( scoreGainPos + scoreGainNeg ) );
|
const double beta = simulatedAnnealingTemperatureCoef * std::sqrt( static_cast<float>(i) ) / ( nSamples * ( scoreGainPos + scoreGainNeg ) );
|
||||||
if ( rng.uniform( 0.0, 1.0 ) > std::exp( -beta * ( localBestScore - score) ) )
|
if ( rng.uniform( 0.0, 1.0 ) > std::exp( -beta * ( localBestScore - score) ) )
|
||||||
coef[pos] = randomModification;
|
coef[pos] = randomModification;
|
||||||
}
|
}
|
||||||
|
@@ -100,8 +100,8 @@ TEST_P(DenseOpticalFlow_DIS, MultithreadReproducibility)
|
|||||||
// resulting flow should be within the frame bounds:
|
// resulting flow should be within the frame bounds:
|
||||||
double min_val, max_val;
|
double min_val, max_val;
|
||||||
minMaxLoc(resMultiThread, &min_val, &max_val);
|
minMaxLoc(resMultiThread, &min_val, &max_val);
|
||||||
EXPECT_LE(abs(min_val), sqrt(size.height * size.height + size.width * size.width));
|
EXPECT_LE(abs(min_val), sqrt( static_cast<double>(size.height * size.height + size.width * size.width)) );
|
||||||
EXPECT_LE(abs(max_val), sqrt(size.height * size.height + size.width * size.width));
|
EXPECT_LE(abs(max_val), sqrt( static_cast<double>(size.height * size.height + size.width * size.width)) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,8 +151,8 @@ TEST_P(DenseOpticalFlow_VariationalRefinement, MultithreadReproducibility)
|
|||||||
// resulting flow should be within the frame bounds:
|
// resulting flow should be within the frame bounds:
|
||||||
double min_val, max_val;
|
double min_val, max_val;
|
||||||
minMaxLoc(resMultiThread, &min_val, &max_val);
|
minMaxLoc(resMultiThread, &min_val, &max_val);
|
||||||
EXPECT_LE(abs(min_val), sqrt(size.height * size.height + size.width * size.width));
|
EXPECT_LE(abs(min_val), sqrt( static_cast<double>(size.height * size.height + size.width * size.width)) );
|
||||||
EXPECT_LE(abs(max_val), sqrt(size.height * size.height + size.width * size.width));
|
EXPECT_LE(abs(max_val), sqrt( static_cast<double>(size.height * size.height + size.width * size.width)) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -477,7 +477,7 @@ void normalize( const Mat &pts, const int& dim, Mat& normpts, Mat &T )
|
|||||||
averagedist = averagedist+(float)norm(ptstmp);
|
averagedist = averagedist+(float)norm(ptstmp);
|
||||||
}
|
}
|
||||||
averagedist = averagedist / normpts.cols;
|
averagedist = averagedist / normpts.cols;
|
||||||
scale = (float)(sqrt(dim) / averagedist);
|
scale = (float)(sqrt(static_cast<float>(dim)) / averagedist);
|
||||||
|
|
||||||
normpts = normpts * scale;
|
normpts = normpts * scale;
|
||||||
|
|
||||||
|
@@ -200,12 +200,12 @@ bool SinusoidalPatternProfilometry_Impl::generate( OutputArrayOfArrays pattern )
|
|||||||
if( params.horizontal )
|
if( params.horizontal )
|
||||||
{
|
{
|
||||||
period = params.height / params.nbrOfPeriods;
|
period = params.height / params.nbrOfPeriods;
|
||||||
nbrOfMarkersOnOneRow = (int)floor((params.width - firstMarkerOffset) / m);
|
nbrOfMarkersOnOneRow = (int)floor(static_cast<float>((params.width - firstMarkerOffset) / m));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
period = params.width / params.nbrOfPeriods;
|
period = params.width / params.nbrOfPeriods;
|
||||||
nbrOfMarkersOnOneRow = (int)floor((params.height - firstMarkerOffset) / m);
|
nbrOfMarkersOnOneRow = (int)floor(static_cast<float>((params.height - firstMarkerOffset) / m));
|
||||||
}
|
}
|
||||||
frequency = (float) 1 / period;
|
frequency = (float) 1 / period;
|
||||||
|
|
||||||
|
@@ -117,7 +117,7 @@ int main(int argc, char** argv)
|
|||||||
cerr << "Sample count have to be a positive integer: " << argv[1] << endl;
|
cerr << "Sample count have to be a positive integer: " << argv[1] << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
initSeedCount = (int)floor(initSampleCount / 4);
|
initSeedCount = (int)floor(static_cast<float>(initSampleCount / 4));
|
||||||
initSeedCount = std::max(1, initSeedCount); // fallback if sample count == 1
|
initSeedCount = std::max(1, initSeedCount); // fallback if sample count == 1
|
||||||
}
|
}
|
||||||
if (argc > 2) // seed count
|
if (argc > 2) // seed count
|
||||||
|
@@ -63,7 +63,7 @@ namespace ximgproc
|
|||||||
if (sigmaAlpha < 0)
|
if (sigmaAlpha < 0)
|
||||||
sigmaAlpha = 5. * fr;
|
sigmaAlpha = 5. * fr;
|
||||||
if (sigmaAvg < 0)
|
if (sigmaAvg < 0)
|
||||||
sigmaAvg = 0.05 * sqrt(src.channels());
|
sigmaAvg = 0.05 * sqrt(static_cast<float>(src.channels()));
|
||||||
|
|
||||||
Mat I;
|
Mat I;
|
||||||
src.copyTo(I);
|
src.copyTo(I);
|
||||||
|
Reference in New Issue
Block a user