From afc79e2a02110d47aad49bbe81a15dcd07f1f46f Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Tue, 23 Oct 2012 13:08:43 +0400 Subject: [PATCH] Fix warnings from MSVC 9 64-bit --- modules/features2d/src/fast.cpp | 4 ++++ modules/imgproc/perf/perf_warp.cpp | 12 ++++++++---- modules/stitching/src/seam_finders.cpp | 6 +++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/modules/features2d/src/fast.cpp b/modules/features2d/src/fast.cpp index 92d57e018..40442ef18 100644 --- a/modules/features2d/src/fast.cpp +++ b/modules/features2d/src/fast.cpp @@ -44,6 +44,10 @@ The references are: #include "precomp.hpp" #include "fast_score.hpp" +#if defined _MSC_VER +# pragma warning( disable : 4127) +#endif + namespace cv { diff --git a/modules/imgproc/perf/perf_warp.cpp b/modules/imgproc/perf/perf_warp.cpp index 1c321db0a..20dbffac5 100644 --- a/modules/imgproc/perf/perf_warp.cpp +++ b/modules/imgproc/perf/perf_warp.cpp @@ -120,10 +120,14 @@ PERF_TEST_P( TestWarpPerspectiveNear_t, WarpPerspectiveNear, resize(src, src, size); int shift = src.cols*0.04; - Mat srcVertices = (Mat_(1, 4) << Vec2f(0, 0), Vec2f(size.width-1, 0), - Vec2f(size.width-1, size.height-1), Vec2f(0, size.height-1)); - Mat dstVertices = (Mat_(1, 4) << Vec2f(0, shift), Vec2f(size.width-shift/2, 0), - Vec2f(size.width-shift, size.height-shift), Vec2f(shift/2, size.height-1)); + Mat srcVertices = (Mat_(1, 4) << Vec2f(0, 0), + Vec2f(static_cast(size.width-1), 0), + Vec2f(static_cast(size.width-1), static_cast(size.height-1)), + Vec2f(0, static_cast(size.height-1))); + Mat dstVertices = (Mat_(1, 4) << Vec2f(0, static_cast(shift)), + Vec2f(static_cast(size.width-shift/2), 0), + Vec2f(static_cast(size.width-shift), static_cast(size.height-shift)), + Vec2f(static_cast(shift/2), static_cast(size.height-1))); Mat warpMat = getPerspectiveTransform(srcVertices, dstVertices); Mat dst(size, type); diff --git a/modules/stitching/src/seam_finders.cpp b/modules/stitching/src/seam_finders.cpp index 383adc70b..1439a6919 100644 --- a/modules/stitching/src/seam_finders.cpp +++ b/modules/stitching/src/seam_finders.cpp @@ -628,7 +628,7 @@ bool DpSeamFinder::getSeamTips(int comp1, int comp2, Point &p1, Point &p2) { for (int j = i+1; j < nlabels; ++j) { - double size1 = points[i].size(), size2 = points[j].size(); + double size1 = static_cast(points[i].size()), size2 = static_cast(points[j].size()); double cx1 = cvRound(sum[i].x / size1), cy1 = cvRound(sum[i].y / size1); double cx2 = cvRound(sum[j].x / size2), cy2 = cvRound(sum[j].y / size1); @@ -648,7 +648,7 @@ bool DpSeamFinder::getSeamTips(int comp1, int comp2, Point &p1, Point &p2) for (int i = 0; i < 2; ++i) { - double size = points[idx[i]].size(); + double size = static_cast(points[idx[i]].size()); double cx = cvRound(sum[idx[i]].x / size); double cy = cvRound(sum[idx[i]].y / size); @@ -1036,7 +1036,7 @@ void DpSeamFinder::updateLabelsUsingSeam( for (map::iterator itr = connect2.begin(); itr != connect2.end(); ++itr) { - double len = contours_[comp1].size(); + double len = static_cast(contours_[comp1].size()); isAdjComp[itr->first] = itr->second / len > 0.05 && connectOther.find(itr->first)->second / len < 0.1; }