diff --git a/modules/calib3d/src/ptsetreg.cpp b/modules/calib3d/src/ptsetreg.cpp index e83e19a20..f41769654 100644 --- a/modules/calib3d/src/ptsetreg.cpp +++ b/modules/calib3d/src/ptsetreg.cpp @@ -206,7 +206,7 @@ public: for( iter = 0; iter < niters; iter++ ) { - int i, goodCount, nmodels; + int i, nmodels; if( count > modelPoints ) { bool found = getSubset( m1, m2, ms1, ms2, rng, 10000 ); @@ -227,7 +227,7 @@ public: for( i = 0; i < nmodels; i++ ) { Mat model_i = model.rowRange( i*modelSize.height, (i+1)*modelSize.height ); - goodCount = findInliers( m1, m2, model_i, err, mask, threshold ); + int goodCount = findInliers( m1, m2, model_i, err, mask, threshold ); if( goodCount > MAX(maxGoodCount, modelPoints-1) ) { @@ -284,7 +284,7 @@ public: int d1 = m1.channels() > 1 ? m1.channels() : m1.cols; int d2 = m2.channels() > 1 ? m2.channels() : m2.cols; int count = m1.checkVector(d1), count2 = m2.checkVector(d2); - double minMedian = DBL_MAX, sigma; + double minMedian = DBL_MAX; RNG rng((uint64)-1); @@ -359,7 +359,7 @@ public: if( minMedian < DBL_MAX ) { - sigma = 2.5*1.4826*(1 + 5./(count - modelPoints))*std::sqrt(minMedian); + double sigma = 2.5*1.4826*(1 + 5./(count - modelPoints))*std::sqrt(minMedian); sigma = MAX( sigma, 0.001 ); count = findInliers( m1, m2, bestModel, err, mask, sigma ); diff --git a/modules/videostab/src/motion_stabilizing.cpp b/modules/videostab/src/motion_stabilizing.cpp index 65bbd73bd..d31c420f6 100644 --- a/modules/videostab/src/motion_stabilizing.cpp +++ b/modules/videostab/src/motion_stabilizing.cpp @@ -602,13 +602,12 @@ static inline bool isGoodMotion(const float M[], float w, float h, float dx, flo { Point2f pt[4] = {Point2f(0,0), Point2f(w,0), Point2f(w,h), Point2f(0,h)}; Point2f Mpt[4]; - float z; for (int i = 0; i < 4; ++i) { Mpt[i].x = M[0]*pt[i].x + M[1]*pt[i].y + M[2]; Mpt[i].y = M[3]*pt[i].x + M[4]*pt[i].y + M[5]; - z = M[6]*pt[i].x + M[7]*pt[i].y + M[8]; + float z = M[6]*pt[i].x + M[7]*pt[i].y + M[8]; Mpt[i].x /= z; Mpt[i].y /= z; } diff --git a/modules/videostab/src/outlier_rejection.cpp b/modules/videostab/src/outlier_rejection.cpp index ee37a9303..3ae6e6b27 100644 --- a/modules/videostab/src/outlier_rejection.cpp +++ b/modules/videostab/src/outlier_rejection.cpp @@ -84,16 +84,14 @@ void TranslationBasedLocalOutlierRejector::process( Size ncells((frameSize.width + cellSize_.width - 1) / cellSize_.width, (frameSize.height + cellSize_.height - 1) / cellSize_.height); - int cx, cy; - // fill grid cells grid_.assign(ncells.area(), Cell()); for (int i = 0; i < npoints; ++i) { - cx = std::min(cvRound(points0_[i].x / cellSize_.width), ncells.width - 1); - cy = std::min(cvRound(points0_[i].y / cellSize_.height), ncells.height - 1); + int cx = std::min(cvRound(points0_[i].x / cellSize_.width), ncells.width - 1); + int cy = std::min(cvRound(points0_[i].y / cellSize_.height), ncells.height - 1); grid_[cy * ncells.width + cx].push_back(i); } @@ -101,19 +99,16 @@ void TranslationBasedLocalOutlierRejector::process( RNG rng(0); int niters = ransacParams_.niters(); - int ninliers, ninliersMax; std::vector inliers; - float dx, dy, dxBest, dyBest; - float x1, y1; - int idx; for (size_t ci = 0; ci < grid_.size(); ++ci) { // estimate translation model at the current cell using RANSAC + float x1, y1; const Cell &cell = grid_[ci]; - ninliersMax = 0; - dxBest = dyBest = 0.f; + int ninliers, ninliersMax = 0; + float dxBest = 0.f, dyBest = 0.f; // find the best hypothesis @@ -121,9 +116,9 @@ void TranslationBasedLocalOutlierRejector::process( { for (int iter = 0; iter < niters; ++iter) { - idx = cell[static_cast(rng) % cell.size()]; - dx = points1_[idx].x - points0_[idx].x; - dy = points1_[idx].y - points0_[idx].y; + int idx = cell[static_cast(rng) % cell.size()]; + float dx = points1_[idx].x - points0_[idx].x; + float dy = points1_[idx].y - points0_[idx].y; ninliers = 0; for (size_t i = 0; i < cell.size(); ++i)