From b7be49426d55526bce7bac92d2e3dd9206a6d40e Mon Sep 17 00:00:00 2001 From: Mansour Moufid Date: Tue, 24 Feb 2015 12:21:34 -0500 Subject: [PATCH] Cast some image coordinates and sizes to double. --- modules/calib3d/test/test_reproject_image_to_3d.cpp | 7 ++++++- modules/calib3d/test/test_undistort_badarg.cpp | 5 ++++- modules/gpu/perf/perf_imgproc.cpp | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/calib3d/test/test_reproject_image_to_3d.cpp b/modules/calib3d/test/test_reproject_image_to_3d.cpp index 0c03831c9..544a8c86a 100644 --- a/modules/calib3d/test/test_reproject_image_to_3d.cpp +++ b/modules/calib3d/test/test_reproject_image_to_3d.cpp @@ -137,7 +137,12 @@ protected: { InT d = disp(y, x); - double from[4] = { x, y, d, 1 }; + double from[4] = { + static_cast(x), + static_cast(y), + static_cast(d), + 1.0, + }; Mat_ res = Q * Mat_(4, 1, from); res /= res(3, 0); diff --git a/modules/calib3d/test/test_undistort_badarg.cpp b/modules/calib3d/test/test_undistort_badarg.cpp index 074d19373..38bc5b3ca 100644 --- a/modules/calib3d/test/test_undistort_badarg.cpp +++ b/modules/calib3d/test/test_undistort_badarg.cpp @@ -101,7 +101,10 @@ void CV_UndistortPointsBadArgTest::run(int) img_size.height = 600; double cam[9] = {150.f, 0.f, img_size.width/2.f, 0, 300.f, img_size.height/2.f, 0.f, 0.f, 1.f}; double dist[4] = {0.01,0.02,0.001,0.0005}; - double s_points[N_POINTS2] = {img_size.width/4,img_size.height/4}; + double s_points[N_POINTS2] = { + static_cast(img_size.width) / 4.0, + static_cast(img_size.height) / 4.0, + }; double d_points[N_POINTS2]; double p[9] = {155.f, 0.f, img_size.width/2.f+img_size.width/50.f, 0, 310.f, img_size.height/2.f+img_size.height/50.f, 0.f, 0.f, 1.f}; double r[9] = {1,0,0,0,1,0,0,0,1}; diff --git a/modules/gpu/perf/perf_imgproc.cpp b/modules/gpu/perf/perf_imgproc.cpp index c8677087e..51150cbd5 100644 --- a/modules/gpu/perf/perf_imgproc.cpp +++ b/modules/gpu/perf/perf_imgproc.cpp @@ -253,7 +253,7 @@ PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpAffine, const double aplha = CV_PI / 4; const double mat[2 * 3] = { - std::cos(aplha), -std::sin(aplha), src.cols / 2, + std::cos(aplha), -std::sin(aplha), static_cast(src.cols) / 2.0, std::sin(aplha), std::cos(aplha), 0 }; const cv::Mat M(2, 3, CV_64F, (void*) mat); @@ -301,7 +301,7 @@ PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpPerspective, declare.in(src, WARMUP_RNG); const double aplha = CV_PI / 4; - double mat[3][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2}, + double mat[3][3] = { {std::cos(aplha), -std::sin(aplha), static_cast(src.cols) / 2.0}, {std::sin(aplha), std::cos(aplha), 0}, {0.0, 0.0, 1.0}}; const cv::Mat M(3, 3, CV_64F, (void*) mat);