diff --git a/3rdparty/libtiff/CMakeLists.txt b/3rdparty/libtiff/CMakeLists.txt index addbb5551..7d7febac7 100644 --- a/3rdparty/libtiff/CMakeLists.txt +++ b/3rdparty/libtiff/CMakeLists.txt @@ -93,6 +93,7 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4100 /wd4127 /wd4311 /wd4701 /wd ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244) # vs2008 ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4267 /wd4305 /wd4306) # vs2008 Win64 ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4703) # vs2012 +ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4456 /wd4457 /wd4312) # vs2015 ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018) diff --git a/3rdparty/openexr/CMakeLists.txt b/3rdparty/openexr/CMakeLists.txt index c4facad2f..c15820bc0 100644 --- a/3rdparty/openexr/CMakeLists.txt +++ b/3rdparty/openexr/CMakeLists.txt @@ -42,6 +42,7 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4099 /wd4100 /wd4101 /wd4127 /wd ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4334) # vs2005 Win64 ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244) # vs2008 ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4267) # vs2008 Win64 +ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4456 /wd4457 /wd4312) # vs2015 if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") diff --git a/apps/haartraining/CMakeLists.txt b/apps/haartraining/CMakeLists.txt index 2ac332316..35a26fe36 100644 --- a/apps/haartraining/CMakeLists.txt +++ b/apps/haartraining/CMakeLists.txt @@ -14,8 +14,6 @@ if(WIN32) link_directories(${CMAKE_CURRENT_BINARY_DIR}) endif() -link_libraries(${OPENCV_HAARTRAINING_DEPS} opencv_haartraining_engine) - # ----------------------------------------------------------- # Library # ----------------------------------------------------------- @@ -35,6 +33,7 @@ set(cvhaartraining_lib_src ) add_library(opencv_haartraining_engine STATIC ${cvhaartraining_lib_src}) +target_link_libraries(opencv_haartraining_engine ${OPENCV_HAARTRAINING_DEPS}) set_target_properties(opencv_haartraining_engine PROPERTIES DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} @@ -47,6 +46,7 @@ set_target_properties(opencv_haartraining_engine PROPERTIES # ----------------------------------------------------------- add_executable(opencv_haartraining cvhaartraining.h haartraining.cpp) +target_link_libraries(opencv_haartraining ${OPENCV_HAARTRAINING_DEPS} opencv_haartraining_engine) set_target_properties(opencv_haartraining PROPERTIES DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" OUTPUT_NAME "opencv_haartraining") @@ -56,6 +56,7 @@ set_target_properties(opencv_haartraining PROPERTIES # ----------------------------------------------------------- add_executable(opencv_createsamples cvhaartraining.h createsamples.cpp) +target_link_libraries(opencv_createsamples ${OPENCV_HAARTRAINING_DEPS} opencv_haartraining_engine) set_target_properties(opencv_createsamples PROPERTIES DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" OUTPUT_NAME "opencv_createsamples") @@ -64,6 +65,7 @@ set_target_properties(opencv_createsamples PROPERTIES # performance # ----------------------------------------------------------- add_executable(opencv_performance performance.cpp) +target_link_libraries(opencv_performance ${OPENCV_HAARTRAINING_DEPS} opencv_haartraining_engine) set_target_properties(opencv_performance PROPERTIES DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" OUTPUT_NAME "opencv_performance") diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index 7b619818d..3f7cbf235 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -320,5 +320,8 @@ if(MSVC) if(NOT ENABLE_NOISY_WARNINGS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251") #class 'std::XXX' needs to have dll-interface to be used by clients of YYY + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4275") # non dll-interface class 'std::exception' used as base for dll-interface class 'cv::Exception' + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4589") # Constructor of abstract class ... ignores initializer for virtual base class 'cv::Algorithm' + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4359") # Alignment specifier is less than actual alignment (4), and will be ignored endif() endif() diff --git a/modules/calib3d/test/test_fisheye.cpp b/modules/calib3d/test/test_fisheye.cpp index 6009106b4..eee6c1dff 100644 --- a/modules/calib3d/test/test_fisheye.cpp +++ b/modules/calib3d/test/test_fisheye.cpp @@ -100,15 +100,15 @@ TEST_F(fisheyeTest, projectPoints) TEST_F(fisheyeTest, undistortImage) { - cv::Matx33d K = this->K; - cv::Mat D = cv::Mat(this->D); + cv::Matx33d theK = this->K; + cv::Mat theD = cv::Mat(this->D); std::string file = combine(datasets_repository_path, "/calib-3_stereo_from_JY/left/stereo_pair_014.jpg"); - cv::Matx33d newK = K; + cv::Matx33d newK = theK; cv::Mat distorted = cv::imread(file), undistorted; { newK(0, 0) = 100; newK(1, 1) = 100; - cv::fisheye::undistortImage(distorted, undistorted, K, D, newK); + cv::fisheye::undistortImage(distorted, undistorted, theK, theD, newK); cv::Mat correct = cv::imread(combine(datasets_repository_path, "new_f_100.png")); if (correct.empty()) CV_Assert(cv::imwrite(combine(datasets_repository_path, "new_f_100.png"), undistorted)); @@ -117,8 +117,8 @@ TEST_F(fisheyeTest, undistortImage) } { double balance = 1.0; - cv::fisheye::estimateNewCameraMatrixForUndistortRectify(K, D, distorted.size(), cv::noArray(), newK, balance); - cv::fisheye::undistortImage(distorted, undistorted, K, D, newK); + cv::fisheye::estimateNewCameraMatrixForUndistortRectify(theK, theD, distorted.size(), cv::noArray(), newK, balance); + cv::fisheye::undistortImage(distorted, undistorted, theK, theD, newK); cv::Mat correct = cv::imread(combine(datasets_repository_path, "balance_1.0.png")); if (correct.empty()) CV_Assert(cv::imwrite(combine(datasets_repository_path, "balance_1.0.png"), undistorted)); @@ -128,8 +128,8 @@ TEST_F(fisheyeTest, undistortImage) { double balance = 0.0; - cv::fisheye::estimateNewCameraMatrixForUndistortRectify(K, D, distorted.size(), cv::noArray(), newK, balance); - cv::fisheye::undistortImage(distorted, undistorted, K, D, newK); + cv::fisheye::estimateNewCameraMatrixForUndistortRectify(theK, theD, distorted.size(), cv::noArray(), newK, balance); + cv::fisheye::undistortImage(distorted, undistorted, theK, theD, newK); cv::Mat correct = cv::imread(combine(datasets_repository_path, "balance_0.0.png")); if (correct.empty()) CV_Assert(cv::imwrite(combine(datasets_repository_path, "balance_0.0.png"), undistorted)); @@ -142,7 +142,7 @@ TEST_F(fisheyeTest, jacobians) { int n = 10; cv::Mat X(1, n, CV_64FC3); - cv::Mat om(3, 1, CV_64F), T(3, 1, CV_64F); + cv::Mat om(3, 1, CV_64F), theT(3, 1, CV_64F); cv::Mat f(2, 1, CV_64F), c(2, 1, CV_64F); cv::Mat k(4, 1, CV_64F); double alpha; @@ -155,8 +155,8 @@ TEST_F(fisheyeTest, jacobians) r.fill(om, cv::RNG::NORMAL, 0, 1); om = cv::abs(om); - r.fill(T, cv::RNG::NORMAL, 0, 1); - T = cv::abs(T); T.at(2) = 4; T *= 10; + r.fill(theT, cv::RNG::NORMAL, 0, 1); + theT = cv::abs(theT); theT.at(2) = 4; theT *= 10; r.fill(f, cv::RNG::NORMAL, 0, 1); f = cv::abs(f) * 1000; @@ -170,19 +170,19 @@ TEST_F(fisheyeTest, jacobians) alpha = 0.01*r.gaussian(1); cv::Mat x1, x2, xpred; - cv::Matx33d K(f.at(0), alpha * f.at(0), c.at(0), + cv::Matx33d theK(f.at(0), alpha * f.at(0), c.at(0), 0, f.at(1), c.at(1), 0, 0, 1); cv::Mat jacobians; - cv::fisheye::projectPoints(X, x1, om, T, K, k, alpha, jacobians); + cv::fisheye::projectPoints(X, x1, om, theT, theK, k, alpha, jacobians); //test on T: cv::Mat dT(3, 1, CV_64FC1); r.fill(dT, cv::RNG::NORMAL, 0, 1); - dT *= 1e-9*cv::norm(T); - cv::Mat T2 = T + dT; - cv::fisheye::projectPoints(X, x2, om, T2, K, k, alpha, cv::noArray()); + dT *= 1e-9*cv::norm(theT); + cv::Mat T2 = theT + dT; + cv::fisheye::projectPoints(X, x2, om, T2, theK, k, alpha, cv::noArray()); xpred = x1 + cv::Mat(jacobians.colRange(11,14) * dT).reshape(2, 1); CV_Assert (cv::norm(x2 - xpred) < 1e-10); @@ -191,7 +191,7 @@ TEST_F(fisheyeTest, jacobians) r.fill(dom, cv::RNG::NORMAL, 0, 1); dom *= 1e-9*cv::norm(om); cv::Mat om2 = om + dom; - cv::fisheye::projectPoints(X, x2, om2, T, K, k, alpha, cv::noArray()); + cv::fisheye::projectPoints(X, x2, om2, theT, theK, k, alpha, cv::noArray()); xpred = x1 + cv::Mat(jacobians.colRange(8,11) * dom).reshape(2, 1); CV_Assert (cv::norm(x2 - xpred) < 1e-10); @@ -199,8 +199,8 @@ TEST_F(fisheyeTest, jacobians) cv::Mat df(2, 1, CV_64FC1); r.fill(df, cv::RNG::NORMAL, 0, 1); df *= 1e-9*cv::norm(f); - cv::Matx33d K2 = K + cv::Matx33d(df.at(0), df.at(0) * alpha, 0, 0, df.at(1), 0, 0, 0, 0); - cv::fisheye::projectPoints(X, x2, om, T, K2, k, alpha, cv::noArray()); + cv::Matx33d K2 = theK + cv::Matx33d(df.at(0), df.at(0) * alpha, 0, 0, df.at(1), 0, 0, 0, 0); + cv::fisheye::projectPoints(X, x2, om, theT, K2, k, alpha, cv::noArray()); xpred = x1 + cv::Mat(jacobians.colRange(0,2) * df).reshape(2, 1); CV_Assert (cv::norm(x2 - xpred) < 1e-10); @@ -208,8 +208,8 @@ TEST_F(fisheyeTest, jacobians) cv::Mat dc(2, 1, CV_64FC1); r.fill(dc, cv::RNG::NORMAL, 0, 1); dc *= 1e-9*cv::norm(c); - K2 = K + cv::Matx33d(0, 0, dc.at(0), 0, 0, dc.at(1), 0, 0, 0); - cv::fisheye::projectPoints(X, x2, om, T, K2, k, alpha, cv::noArray()); + K2 = theK + cv::Matx33d(0, 0, dc.at(0), 0, 0, dc.at(1), 0, 0, 0); + cv::fisheye::projectPoints(X, x2, om, theT, K2, k, alpha, cv::noArray()); xpred = x1 + cv::Mat(jacobians.colRange(2,4) * dc).reshape(2, 1); CV_Assert (cv::norm(x2 - xpred) < 1e-10); @@ -218,7 +218,7 @@ TEST_F(fisheyeTest, jacobians) r.fill(dk, cv::RNG::NORMAL, 0, 1); dk *= 1e-9*cv::norm(k); cv::Mat k2 = k + dk; - cv::fisheye::projectPoints(X, x2, om, T, K, k2, alpha, cv::noArray()); + cv::fisheye::projectPoints(X, x2, om, theT, theK, k2, alpha, cv::noArray()); xpred = x1 + cv::Mat(jacobians.colRange(4,8) * dk).reshape(2, 1); CV_Assert (cv::norm(x2 - xpred) < 1e-10); @@ -227,8 +227,8 @@ TEST_F(fisheyeTest, jacobians) r.fill(dalpha, cv::RNG::NORMAL, 0, 1); dalpha *= 1e-9*cv::norm(f); double alpha2 = alpha + dalpha.at(0); - K2 = K + cv::Matx33d(0, f.at(0) * dalpha.at(0), 0, 0, 0, 0, 0, 0, 0); - cv::fisheye::projectPoints(X, x2, om, T, K, k, alpha2, cv::noArray()); + K2 = theK + cv::Matx33d(0, f.at(0) * dalpha.at(0), 0, 0, 0, 0, 0, 0, 0); + cv::fisheye::projectPoints(X, x2, om, theT, theK, k, alpha2, cv::noArray()); xpred = x1 + cv::Mat(jacobians.col(14) * dalpha).reshape(2, 1); CV_Assert (cv::norm(x2 - xpred) < 1e-10); } @@ -258,14 +258,14 @@ TEST_F(fisheyeTest, Calibration) flag |= cv::fisheye::CALIB_CHECK_COND; flag |= cv::fisheye::CALIB_FIX_SKEW; - cv::Matx33d K; - cv::Vec4d D; + cv::Matx33d theK; + cv::Vec4d theD; - cv::fisheye::calibrate(objectPoints, imagePoints, imageSize, K, D, + cv::fisheye::calibrate(objectPoints, imagePoints, imageSize, theK, theD, cv::noArray(), cv::noArray(), flag, cv::TermCriteria(3, 20, 1e-6)); - EXPECT_MAT_NEAR(K, this->K, 1e-10); - EXPECT_MAT_NEAR(D, this->D, 1e-10); + EXPECT_MAT_NEAR(theK, this->K, 1e-10); + EXPECT_MAT_NEAR(theD, this->D, 1e-10); } TEST_F(fisheyeTest, Homography) @@ -302,15 +302,15 @@ TEST_F(fisheyeTest, Homography) int Np = imagePointsNormalized.cols; cv::calcCovarMatrix(_objectPoints, covObjectPoints, objectPointsMean, CV_COVAR_NORMAL | CV_COVAR_COLS); cv::SVD svd(covObjectPoints); - cv::Mat R(svd.vt); + cv::Mat theR(svd.vt); - if (cv::norm(R(cv::Rect(2, 0, 1, 2))) < 1e-6) - R = cv::Mat::eye(3,3, CV_64FC1); - if (cv::determinant(R) < 0) - R = -R; + if (cv::norm(theR(cv::Rect(2, 0, 1, 2))) < 1e-6) + theR = cv::Mat::eye(3,3, CV_64FC1); + if (cv::determinant(theR) < 0) + theR = -theR; - cv::Mat T = -R * objectPointsMean; - cv::Mat X_new = R * _objectPoints + T * cv::Mat::ones(1, Np, CV_64FC1); + cv::Mat theT = -theR * objectPointsMean; + cv::Mat X_new = theR * _objectPoints + theT * cv::Mat::ones(1, Np, CV_64FC1); cv::Mat H = cv::internal::ComputeHomography(imagePointsNormalized, X_new.rowRange(0, 2)); cv::Mat M = cv::Mat::ones(3, X_new.cols, CV_64FC1); @@ -354,19 +354,19 @@ TEST_F(fisheyeTest, EtimateUncertainties) flag |= cv::fisheye::CALIB_CHECK_COND; flag |= cv::fisheye::CALIB_FIX_SKEW; - cv::Matx33d K; - cv::Vec4d D; + cv::Matx33d theK; + cv::Vec4d theD; std::vector rvec; std::vector tvec; - cv::fisheye::calibrate(objectPoints, imagePoints, imageSize, K, D, + cv::fisheye::calibrate(objectPoints, imagePoints, imageSize, theK, theD, rvec, tvec, flag, cv::TermCriteria(3, 20, 1e-6)); cv::internal::IntrinsicParams param, errors; cv::Vec2d err_std; double thresh_cond = 1e6; int check_cond = 1; - param.Init(cv::Vec2d(K(0,0), K(1,1)), cv::Vec2d(K(0,2), K(1, 2)), D); + param.Init(cv::Vec2d(theK(0,0), theK(1,1)), cv::Vec2d(theK(0,2), theK(1, 2)), theD); param.isEstimate = std::vector(9, 1); param.isEstimate[4] = 0; @@ -397,12 +397,12 @@ TEST_F(fisheyeTest, rectify) cv::Matx33d K1 = this->K, K2 = K1; cv::Mat D1 = cv::Mat(this->D), D2 = D1; - cv::Vec3d T = this->T; - cv::Matx33d R = this->R; + cv::Vec3d theT = this->T; + cv::Matx33d theR = this->R; double balance = 0.0, fov_scale = 1.1; cv::Mat R1, R2, P1, P2, Q; - cv::fisheye::stereoRectify(K1, D1, K2, D2, calibration_size, R, T, R1, R2, P1, P2, Q, + cv::fisheye::stereoRectify(K1, D1, K2, D2, calibration_size, theR, theT, R1, R2, P1, P2, Q, cv::CALIB_ZERO_DISPARITY, requested_size, balance, fov_scale); cv::Mat lmapx, lmapy, rmapx, rmapy; @@ -466,8 +466,8 @@ TEST_F(fisheyeTest, stereoCalibrate) fs_object[cv::format("image_%d", i )] >> objectPoints[i]; fs_object.release(); - cv::Matx33d K1, K2, R; - cv::Vec3d T; + cv::Matx33d K1, K2, theR; + cv::Vec3d theT; cv::Vec4d D1, D2; int flag = 0; @@ -477,7 +477,7 @@ TEST_F(fisheyeTest, stereoCalibrate) // flag |= cv::fisheye::CALIB_FIX_INTRINSIC; cv::fisheye::stereoCalibrate(objectPoints, leftPoints, rightPoints, - K1, D1, K2, D2, imageSize, R, T, flag, + K1, D1, K2, D2, imageSize, theR, theT, flag, cv::TermCriteria(3, 12, 0)); cv::Matx33d R_correct( 0.9975587205950972, 0.06953016383322372, 0.006492709911733523, @@ -495,8 +495,8 @@ TEST_F(fisheyeTest, stereoCalibrate) cv::Vec4d D1_correct (-7.44253716539556e-05, -0.00702662033932424, 0.00737569823650885, -0.00342230256441771); cv::Vec4d D2_correct (-0.0130785435677431, 0.0284434505383497, -0.0360333869900506, 0.0144724062347222); - EXPECT_MAT_NEAR(R, R_correct, 1e-10); - EXPECT_MAT_NEAR(T, T_correct, 1e-10); + EXPECT_MAT_NEAR(theR, R_correct, 1e-10); + EXPECT_MAT_NEAR(theT, T_correct, 1e-10); EXPECT_MAT_NEAR(K1, K1_correct, 1e-10); EXPECT_MAT_NEAR(K2, K2_correct, 1e-10); @@ -534,8 +534,8 @@ TEST_F(fisheyeTest, stereoCalibrateFixIntrinsic) fs_object[cv::format("image_%d", i )] >> objectPoints[i]; fs_object.release(); - cv::Matx33d R; - cv::Vec3d T; + cv::Matx33d theR; + cv::Vec3d theT; int flag = 0; flag |= cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC; @@ -555,7 +555,7 @@ TEST_F(fisheyeTest, stereoCalibrateFixIntrinsic) cv::Vec4d D2 (-0.0130785435677431, 0.0284434505383497, -0.0360333869900506, 0.0144724062347222); cv::fisheye::stereoCalibrate(objectPoints, leftPoints, rightPoints, - K1, D1, K2, D2, imageSize, R, T, flag, + K1, D1, K2, D2, imageSize, theR, theT, flag, cv::TermCriteria(3, 12, 0)); cv::Matx33d R_correct( 0.9975587205950972, 0.06953016383322372, 0.006492709911733523, @@ -564,8 +564,8 @@ TEST_F(fisheyeTest, stereoCalibrateFixIntrinsic) cv::Vec3d T_correct(-0.099402724724121, 0.00270812139265413, 0.00129330292472699); - EXPECT_MAT_NEAR(R, R_correct, 1e-10); - EXPECT_MAT_NEAR(T, T_correct, 1e-10); + EXPECT_MAT_NEAR(theR, R_correct, 1e-10); + EXPECT_MAT_NEAR(theT, T_correct, 1e-10); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/modules/contrib/src/colormap.cpp b/modules/contrib/src/colormap.cpp index bb317f7c4..c40fc6638 100644 --- a/modules/contrib/src/colormap.cpp +++ b/modules/contrib/src/colormap.cpp @@ -189,7 +189,7 @@ namespace colormap void init(int n) { float r[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - float g[] = { 0, 0.01587301587301587, 0.03174603174603174, 0.04761904761904762, 0.06349206349206349, 0.07936507936507936, 0.09523809523809523, 0.1111111111111111, 0.126984126984127, 0.1428571428571428, 0.1587301587301587, 0.1746031746031746, 0.1904761904761905, 0.2063492063492063, 0.2222222222222222, 0.2380952380952381, 0.253968253968254, 0.2698412698412698, 0.2857142857142857, 0.3015873015873016, 0.3174603174603174, 0.3333333333333333, 0.3492063492063492, 0.3650793650793651, 0.3809523809523809, 0.3968253968253968, 0.4126984126984127, 0.4285714285714285, 0.4444444444444444, 0.4603174603174603, 0.4761904761904762, 0.492063492063492, 0.5079365079365079, 0.5238095238095238, 0.5396825396825397, 0.5555555555555556, 0.5714285714285714, 0.5873015873015873, 0.6031746031746031, 0.6190476190476191, 0.6349206349206349, 0.6507936507936508, 0.6666666666666666, 0.6825396825396826, 0.6984126984126984, 0.7142857142857143, 0.7301587301587301, 0.746031746031746, 0.7619047619047619, 0.7777777777777778, 0.7936507936507936, 0.8095238095238095, 0.8253968253968254, 0.8412698412698413, 0.8571428571428571, 0.873015873015873, 0.8888888888888888, 0.9047619047619048, 0.9206349206349206, 0.9365079365079365, 0.9523809523809523, 0.9682539682539683, 0.9841269841269841, 1}; + float g[] = { 0, 0.01587301587301587f, 0.03174603174603174f, 0.04761904761904762f, 0.06349206349206349f, 0.07936507936507936f, 0.09523809523809523f, 0.1111111111111111f, 0.126984126984127f, 0.1428571428571428f, 0.1587301587301587f, 0.1746031746031746f, 0.1904761904761905f, 0.2063492063492063f, 0.2222222222222222f, 0.2380952380952381f, 0.253968253968254f, 0.2698412698412698f, 0.2857142857142857f, 0.3015873015873016f, 0.3174603174603174f, 0.3333333333333333f, 0.3492063492063492f, 0.3650793650793651f, 0.3809523809523809f, 0.3968253968253968f, 0.4126984126984127f, 0.4285714285714285f, 0.4444444444444444f, 0.4603174603174603f, 0.4761904761904762f, 0.492063492063492f, 0.5079365079365079f, 0.5238095238095238f, 0.5396825396825397f, 0.5555555555555556f, 0.5714285714285714f, 0.5873015873015873f, 0.6031746031746031f, 0.6190476190476191f, 0.6349206349206349f, 0.6507936507936508f, 0.6666666666666666f, 0.6825396825396826f, 0.6984126984126984f, 0.7142857142857143f, 0.7301587301587301f, 0.746031746031746f, 0.7619047619047619f, 0.7777777777777778f, 0.7936507936507936f, 0.8095238095238095f, 0.8253968253968254f, 0.8412698412698413f, 0.8571428571428571f, 0.873015873015873f, 0.8888888888888888f, 0.9047619047619048f, 0.9206349206349206f, 0.9365079365079365f, 0.9523809523809523f, 0.9682539682539683f, 0.9841269841269841f, 1}; float b[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Mat X = linspace(0,1,64); this->_lut = ColorMap::linear_colormap(X, @@ -212,9 +212,9 @@ namespace colormap } void init(int n) { - float r[] = { 0, 0.01388888888888889, 0.02777777777777778, 0.04166666666666666, 0.05555555555555555, 0.06944444444444445, 0.08333333333333333, 0.09722222222222221, 0.1111111111111111, 0.125, 0.1388888888888889, 0.1527777777777778, 0.1666666666666667, 0.1805555555555556, 0.1944444444444444, 0.2083333333333333, 0.2222222222222222, 0.2361111111111111, 0.25, 0.2638888888888889, 0.2777777777777778, 0.2916666666666666, 0.3055555555555555, 0.3194444444444444, 0.3333333333333333, 0.3472222222222222, 0.3611111111111111, 0.375, 0.3888888888888888, 0.4027777777777777, 0.4166666666666666, 0.4305555555555555, 0.4444444444444444, 0.4583333333333333, 0.4722222222222222, 0.4861111111111112, 0.5, 0.5138888888888888, 0.5277777777777778, 0.5416666666666667, 0.5555555555555556, 0.5694444444444444, 0.5833333333333333, 0.5972222222222222, 0.611111111111111, 0.6249999999999999, 0.6388888888888888, 0.6527777777777778, 0.6726190476190474, 0.6944444444444442, 0.7162698412698412, 0.7380952380952381, 0.7599206349206349, 0.7817460317460316, 0.8035714285714286, 0.8253968253968254, 0.8472222222222221, 0.8690476190476188, 0.8908730158730158, 0.9126984126984128, 0.9345238095238095, 0.9563492063492063, 0.978174603174603, 1}; - float g[] = { 0, 0.01388888888888889, 0.02777777777777778, 0.04166666666666666, 0.05555555555555555, 0.06944444444444445, 0.08333333333333333, 0.09722222222222221, 0.1111111111111111, 0.125, 0.1388888888888889, 0.1527777777777778, 0.1666666666666667, 0.1805555555555556, 0.1944444444444444, 0.2083333333333333, 0.2222222222222222, 0.2361111111111111, 0.25, 0.2638888888888889, 0.2777777777777778, 0.2916666666666666, 0.3055555555555555, 0.3194444444444444, 0.3353174603174602, 0.3544973544973544, 0.3736772486772486, 0.3928571428571428, 0.412037037037037, 0.4312169312169312, 0.4503968253968254, 0.4695767195767195, 0.4887566137566137, 0.5079365079365078, 0.5271164021164021, 0.5462962962962963, 0.5654761904761904, 0.5846560846560845, 0.6038359788359787, 0.623015873015873, 0.6421957671957671, 0.6613756613756612, 0.6805555555555555, 0.6997354497354497, 0.7189153439153438, 0.7380952380952379, 0.7572751322751322, 0.7764550264550264, 0.7916666666666666, 0.8055555555555555, 0.8194444444444444, 0.8333333333333334, 0.8472222222222222, 0.861111111111111, 0.875, 0.8888888888888888, 0.9027777777777777, 0.9166666666666665, 0.9305555555555555, 0.9444444444444444, 0.9583333333333333, 0.9722222222222221, 0.986111111111111, 1}; - float b[] = { 0, 0.01917989417989418, 0.03835978835978836, 0.05753968253968253, 0.07671957671957672, 0.09589947089947089, 0.1150793650793651, 0.1342592592592592, 0.1534391534391534, 0.1726190476190476, 0.1917989417989418, 0.210978835978836, 0.2301587301587301, 0.2493386243386243, 0.2685185185185185, 0.2876984126984127, 0.3068783068783069, 0.326058201058201, 0.3452380952380952, 0.3644179894179894, 0.3835978835978835, 0.4027777777777777, 0.4219576719576719, 0.4411375661375661, 0.4583333333333333, 0.4722222222222222, 0.4861111111111111, 0.5, 0.5138888888888888, 0.5277777777777777, 0.5416666666666666, 0.5555555555555556, 0.5694444444444444, 0.5833333333333333, 0.5972222222222222, 0.6111111111111112, 0.625, 0.6388888888888888, 0.6527777777777778, 0.6666666666666667, 0.6805555555555556, 0.6944444444444444, 0.7083333333333333, 0.7222222222222222, 0.736111111111111, 0.7499999999999999, 0.7638888888888888, 0.7777777777777778, 0.7916666666666666, 0.8055555555555555, 0.8194444444444444, 0.8333333333333334, 0.8472222222222222, 0.861111111111111, 0.875, 0.8888888888888888, 0.9027777777777777, 0.9166666666666665, 0.9305555555555555, 0.9444444444444444, 0.9583333333333333, 0.9722222222222221, 0.986111111111111, 1}; + float r[] = { 0, 0.01388888888888889f, 0.02777777777777778f, 0.04166666666666666f, 0.05555555555555555f, 0.06944444444444445f, 0.08333333333333333f, 0.09722222222222221f, 0.1111111111111111f, 0.125f, 0.1388888888888889f, 0.1527777777777778f, 0.1666666666666667f, 0.1805555555555556f, 0.1944444444444444f, 0.2083333333333333f, 0.2222222222222222f, 0.2361111111111111f, 0.25f, 0.2638888888888889f, 0.2777777777777778f, 0.2916666666666666f, 0.3055555555555555f, 0.3194444444444444f, 0.3333333333333333f, 0.3472222222222222f, 0.3611111111111111f, 0.375f, 0.3888888888888888f, 0.4027777777777777f, 0.4166666666666666f, 0.4305555555555555f, 0.4444444444444444f, 0.4583333333333333f, 0.4722222222222222f, 0.4861111111111112f, 0.5f, 0.5138888888888888f, 0.5277777777777778f, 0.5416666666666667f, 0.5555555555555556f, 0.5694444444444444f, 0.5833333333333333f, 0.5972222222222222f, 0.611111111111111f, 0.6249999999999999f, 0.6388888888888888f, 0.6527777777777778f, 0.6726190476190474f, 0.6944444444444442f, 0.7162698412698412f, 0.7380952380952381f, 0.7599206349206349f, 0.7817460317460316f, 0.8035714285714286f, 0.8253968253968254f, 0.8472222222222221f, 0.8690476190476188f, 0.8908730158730158f, 0.9126984126984128f, 0.9345238095238095f, 0.9563492063492063f, 0.978174603174603f, 1}; + float g[] = { 0, 0.01388888888888889f, 0.02777777777777778f, 0.04166666666666666f, 0.05555555555555555f, 0.06944444444444445f, 0.08333333333333333f, 0.09722222222222221f, 0.1111111111111111f, 0.125f, 0.1388888888888889f, 0.1527777777777778f, 0.1666666666666667f, 0.1805555555555556f, 0.1944444444444444f, 0.2083333333333333f, 0.2222222222222222f, 0.2361111111111111f, 0.25f, 0.2638888888888889f, 0.2777777777777778f, 0.2916666666666666f, 0.3055555555555555f, 0.3194444444444444f, 0.3353174603174602f, 0.3544973544973544f, 0.3736772486772486f, 0.3928571428571428f, 0.412037037037037f, 0.4312169312169312f, 0.4503968253968254f, 0.4695767195767195f, 0.4887566137566137f, 0.5079365079365078f, 0.5271164021164021f, 0.5462962962962963f, 0.5654761904761904f, 0.5846560846560845f, 0.6038359788359787f, 0.623015873015873f, 0.6421957671957671f, 0.6613756613756612f, 0.6805555555555555f, 0.6997354497354497f, 0.7189153439153438f, 0.7380952380952379f, 0.7572751322751322f, 0.7764550264550264f, 0.7916666666666666f, 0.8055555555555555f, 0.8194444444444444f, 0.8333333333333334f, 0.8472222222222222f, 0.861111111111111f, 0.875f, 0.8888888888888888f, 0.9027777777777777f, 0.9166666666666665f, 0.9305555555555555f, 0.9444444444444444f, 0.9583333333333333f, 0.9722222222222221f, 0.986111111111111f, 1}; + float b[] = { 0, 0.01917989417989418f, 0.03835978835978836f, 0.05753968253968253f, 0.07671957671957672f, 0.09589947089947089f, 0.1150793650793651f, 0.1342592592592592f, 0.1534391534391534f, 0.1726190476190476f, 0.1917989417989418f, 0.210978835978836f, 0.2301587301587301f, 0.2493386243386243f, 0.2685185185185185f, 0.2876984126984127f, 0.3068783068783069f, 0.326058201058201f, 0.3452380952380952f, 0.3644179894179894f, 0.3835978835978835f, 0.4027777777777777f, 0.4219576719576719f, 0.4411375661375661f, 0.4583333333333333f, 0.4722222222222222f, 0.4861111111111111f, 0.5f, 0.5138888888888888f, 0.5277777777777777f, 0.5416666666666666f, 0.5555555555555556f, 0.5694444444444444f, 0.5833333333333333f, 0.5972222222222222f, 0.6111111111111112f, 0.625f, 0.6388888888888888f, 0.6527777777777778f, 0.6666666666666667f, 0.6805555555555556f, 0.6944444444444444f, 0.7083333333333333f, 0.7222222222222222f, 0.736111111111111f, 0.7499999999999999f, 0.7638888888888888f, 0.7777777777777778f, 0.7916666666666666f, 0.8055555555555555f, 0.8194444444444444f, 0.8333333333333334f, 0.8472222222222222f, 0.861111111111111f, 0.875f, 0.8888888888888888f, 0.9027777777777777f, 0.9166666666666665f, 0.9305555555555555f, 0.9444444444444444f, 0.9583333333333333f, 0.9722222222222221f, 0.986111111111111f, 1}; Mat X = linspace(0,1,64); this->_lut = ColorMap::linear_colormap(X, Mat(64,1, CV_32FC1, r).clone(), // red @@ -242,9 +242,9 @@ namespace colormap // breakpoints Mat X = linspace(0,1,256); // define the basemap - float r[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.00588235294117645,0.02156862745098032,0.03725490196078418,0.05294117647058827,0.06862745098039214,0.084313725490196,0.1000000000000001,0.115686274509804,0.1313725490196078,0.1470588235294117,0.1627450980392156,0.1784313725490196,0.1941176470588235,0.2098039215686274,0.2254901960784315,0.2411764705882353,0.2568627450980392,0.2725490196078431,0.2882352941176469,0.303921568627451,0.3196078431372549,0.3352941176470587,0.3509803921568628,0.3666666666666667,0.3823529411764706,0.3980392156862744,0.4137254901960783,0.4294117647058824,0.4450980392156862,0.4607843137254901,0.4764705882352942,0.4921568627450981,0.5078431372549019,0.5235294117647058,0.5392156862745097,0.5549019607843135,0.5705882352941174,0.5862745098039217,0.6019607843137256,0.6176470588235294,0.6333333333333333,0.6490196078431372,0.664705882352941,0.6803921568627449,0.6960784313725492,0.7117647058823531,0.7274509803921569,0.7431372549019608,0.7588235294117647,0.7745098039215685,0.7901960784313724,0.8058823529411763,0.8215686274509801,0.8372549019607844,0.8529411764705883,0.8686274509803922,0.884313725490196,0.8999999999999999,0.9156862745098038,0.9313725490196076,0.947058823529412,0.9627450980392158,0.9784313725490197,0.9941176470588236,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0.9862745098039216,0.9705882352941178,0.9549019607843139,0.93921568627451,0.9235294117647062,0.9078431372549018,0.892156862745098,0.8764705882352941,0.8607843137254902,0.8450980392156864,0.8294117647058825,0.8137254901960786,0.7980392156862743,0.7823529411764705,0.7666666666666666,0.7509803921568627,0.7352941176470589,0.719607843137255,0.7039215686274511,0.6882352941176473,0.6725490196078434,0.6568627450980391,0.6411764705882352,0.6254901960784314,0.6098039215686275,0.5941176470588236,0.5784313725490198,0.5627450980392159,0.5470588235294116,0.5313725490196077,0.5156862745098039,0.5}; - float g[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.001960784313725483,0.01764705882352935,0.03333333333333333,0.0490196078431373,0.06470588235294117,0.08039215686274503,0.09607843137254901,0.111764705882353,0.1274509803921569,0.1431372549019607,0.1588235294117647,0.1745098039215687,0.1901960784313725,0.2058823529411764,0.2215686274509804,0.2372549019607844,0.2529411764705882,0.2686274509803921,0.2843137254901961,0.3,0.3156862745098039,0.3313725490196078,0.3470588235294118,0.3627450980392157,0.3784313725490196,0.3941176470588235,0.4098039215686274,0.4254901960784314,0.4411764705882353,0.4568627450980391,0.4725490196078431,0.4882352941176471,0.503921568627451,0.5196078431372548,0.5352941176470587,0.5509803921568628,0.5666666666666667,0.5823529411764705,0.5980392156862746,0.6137254901960785,0.6294117647058823,0.6450980392156862,0.6607843137254901,0.6764705882352942,0.692156862745098,0.7078431372549019,0.723529411764706,0.7392156862745098,0.7549019607843137,0.7705882352941176,0.7862745098039214,0.8019607843137255,0.8176470588235294,0.8333333333333333,0.8490196078431373,0.8647058823529412,0.8803921568627451,0.8960784313725489,0.9117647058823528,0.9274509803921569,0.9431372549019608,0.9588235294117646,0.9745098039215687,0.9901960784313726,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0.9901960784313726,0.9745098039215687,0.9588235294117649,0.943137254901961,0.9274509803921571,0.9117647058823528,0.8960784313725489,0.8803921568627451,0.8647058823529412,0.8490196078431373,0.8333333333333335,0.8176470588235296,0.8019607843137253,0.7862745098039214,0.7705882352941176,0.7549019607843137,0.7392156862745098,0.723529411764706,0.7078431372549021,0.6921568627450982,0.6764705882352944,0.6607843137254901,0.6450980392156862,0.6294117647058823,0.6137254901960785,0.5980392156862746,0.5823529411764707,0.5666666666666669,0.5509803921568626,0.5352941176470587,0.5196078431372548,0.503921568627451,0.4882352941176471,0.4725490196078432,0.4568627450980394,0.4411764705882355,0.4254901960784316,0.4098039215686273,0.3941176470588235,0.3784313725490196,0.3627450980392157,0.3470588235294119,0.331372549019608,0.3156862745098041,0.2999999999999998,0.284313725490196,0.2686274509803921,0.2529411764705882,0.2372549019607844,0.2215686274509805,0.2058823529411766,0.1901960784313728,0.1745098039215689,0.1588235294117646,0.1431372549019607,0.1274509803921569,0.111764705882353,0.09607843137254912,0.08039215686274526,0.06470588235294139,0.04901960784313708,0.03333333333333321,0.01764705882352935,0.001960784313725483,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - float b[] = {0.5,0.5156862745098039,0.5313725490196078,0.5470588235294118,0.5627450980392157,0.5784313725490196,0.5941176470588235,0.6098039215686275,0.6254901960784314,0.6411764705882352,0.6568627450980392,0.6725490196078432,0.6882352941176471,0.7039215686274509,0.7196078431372549,0.7352941176470589,0.7509803921568627,0.7666666666666666,0.7823529411764706,0.7980392156862746,0.8137254901960784,0.8294117647058823,0.8450980392156863,0.8607843137254902,0.8764705882352941,0.892156862745098,0.907843137254902,0.9235294117647059,0.9392156862745098,0.9549019607843137,0.9705882352941176,0.9862745098039216,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0.9941176470588236,0.9784313725490197,0.9627450980392158,0.9470588235294117,0.9313725490196079,0.915686274509804,0.8999999999999999,0.884313725490196,0.8686274509803922,0.8529411764705883,0.8372549019607844,0.8215686274509804,0.8058823529411765,0.7901960784313726,0.7745098039215685,0.7588235294117647,0.7431372549019608,0.7274509803921569,0.7117647058823531,0.696078431372549,0.6803921568627451,0.6647058823529413,0.6490196078431372,0.6333333333333333,0.6176470588235294,0.6019607843137256,0.5862745098039217,0.5705882352941176,0.5549019607843138,0.5392156862745099,0.5235294117647058,0.5078431372549019,0.4921568627450981,0.4764705882352942,0.4607843137254903,0.4450980392156865,0.4294117647058826,0.4137254901960783,0.3980392156862744,0.3823529411764706,0.3666666666666667,0.3509803921568628,0.335294117647059,0.3196078431372551,0.3039215686274508,0.2882352941176469,0.2725490196078431,0.2568627450980392,0.2411764705882353,0.2254901960784315,0.2098039215686276,0.1941176470588237,0.1784313725490199,0.1627450980392156,0.1470588235294117,0.1313725490196078,0.115686274509804,0.1000000000000001,0.08431372549019622,0.06862745098039236,0.05294117647058805,0.03725490196078418,0.02156862745098032,0.00588235294117645,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + float r[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.00588235294117645f,0.02156862745098032f,0.03725490196078418f,0.05294117647058827f,0.06862745098039214f,0.084313725490196f,0.1000000000000001f,0.115686274509804f,0.1313725490196078f,0.1470588235294117f,0.1627450980392156f,0.1784313725490196f,0.1941176470588235f,0.2098039215686274f,0.2254901960784315f,0.2411764705882353f,0.2568627450980392f,0.2725490196078431f,0.2882352941176469f,0.303921568627451f,0.3196078431372549f,0.3352941176470587f,0.3509803921568628f,0.3666666666666667f,0.3823529411764706f,0.3980392156862744f,0.4137254901960783f,0.4294117647058824f,0.4450980392156862f,0.4607843137254901f,0.4764705882352942f,0.4921568627450981f,0.5078431372549019f,0.5235294117647058f,0.5392156862745097f,0.5549019607843135f,0.5705882352941174f,0.5862745098039217f,0.6019607843137256f,0.6176470588235294f,0.6333333333333333f,0.6490196078431372f,0.664705882352941f,0.6803921568627449f,0.6960784313725492f,0.7117647058823531f,0.7274509803921569f,0.7431372549019608f,0.7588235294117647f,0.7745098039215685f,0.7901960784313724f,0.8058823529411763f,0.8215686274509801f,0.8372549019607844f,0.8529411764705883f,0.8686274509803922f,0.884313725490196f,0.8999999999999999f,0.9156862745098038f,0.9313725490196076f,0.947058823529412f,0.9627450980392158f,0.9784313725490197f,0.9941176470588236f,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0.9862745098039216f,0.9705882352941178f,0.9549019607843139f,0.93921568627451f,0.9235294117647062f,0.9078431372549018f,0.892156862745098f,0.8764705882352941f,0.8607843137254902f,0.8450980392156864f,0.8294117647058825f,0.8137254901960786f,0.7980392156862743f,0.7823529411764705f,0.7666666666666666f,0.7509803921568627f,0.7352941176470589f,0.719607843137255f,0.7039215686274511f,0.6882352941176473f,0.6725490196078434f,0.6568627450980391f,0.6411764705882352f,0.6254901960784314f,0.6098039215686275f,0.5941176470588236f,0.5784313725490198f,0.5627450980392159f,0.5470588235294116f,0.5313725490196077f,0.5156862745098039f,0.5f}; + float g[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.001960784313725483f,0.01764705882352935f,0.03333333333333333f,0.0490196078431373f,0.06470588235294117f,0.08039215686274503f,0.09607843137254901f,0.111764705882353f,0.1274509803921569f,0.1431372549019607f,0.1588235294117647f,0.1745098039215687f,0.1901960784313725f,0.2058823529411764f,0.2215686274509804f,0.2372549019607844f,0.2529411764705882f,0.2686274509803921f,0.2843137254901961f,0.3f,0.3156862745098039f,0.3313725490196078f,0.3470588235294118f,0.3627450980392157f,0.3784313725490196f,0.3941176470588235f,0.4098039215686274f,0.4254901960784314f,0.4411764705882353f,0.4568627450980391f,0.4725490196078431f,0.4882352941176471f,0.503921568627451f,0.5196078431372548f,0.5352941176470587f,0.5509803921568628f,0.5666666666666667f,0.5823529411764705f,0.5980392156862746f,0.6137254901960785f,0.6294117647058823f,0.6450980392156862f,0.6607843137254901f,0.6764705882352942f,0.692156862745098f,0.7078431372549019f,0.723529411764706f,0.7392156862745098f,0.7549019607843137f,0.7705882352941176f,0.7862745098039214f,0.8019607843137255f,0.8176470588235294f,0.8333333333333333f,0.8490196078431373f,0.8647058823529412f,0.8803921568627451f,0.8960784313725489f,0.9117647058823528f,0.9274509803921569f,0.9431372549019608f,0.9588235294117646f,0.9745098039215687f,0.9901960784313726f,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0.9901960784313726f,0.9745098039215687f,0.9588235294117649f,0.943137254901961f,0.9274509803921571f,0.9117647058823528f,0.8960784313725489f,0.8803921568627451f,0.8647058823529412f,0.8490196078431373f,0.8333333333333335f,0.8176470588235296f,0.8019607843137253f,0.7862745098039214f,0.7705882352941176f,0.7549019607843137f,0.7392156862745098f,0.723529411764706f,0.7078431372549021f,0.6921568627450982f,0.6764705882352944f,0.6607843137254901f,0.6450980392156862f,0.6294117647058823f,0.6137254901960785f,0.5980392156862746f,0.5823529411764707f,0.5666666666666669f,0.5509803921568626f,0.5352941176470587f,0.5196078431372548f,0.503921568627451f,0.4882352941176471f,0.4725490196078432f,0.4568627450980394f,0.4411764705882355f,0.4254901960784316f,0.4098039215686273f,0.3941176470588235f,0.3784313725490196f,0.3627450980392157f,0.3470588235294119f,0.331372549019608f,0.3156862745098041f,0.2999999999999998f,0.284313725490196f,0.2686274509803921f,0.2529411764705882f,0.2372549019607844f,0.2215686274509805f,0.2058823529411766f,0.1901960784313728f,0.1745098039215689f,0.1588235294117646f,0.1431372549019607f,0.1274509803921569f,0.111764705882353f,0.09607843137254912f,0.08039215686274526f,0.06470588235294139f,0.04901960784313708f,0.03333333333333321f,0.01764705882352935f,0.001960784313725483f,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + float b[] = {0.5f,0.5156862745098039f,0.5313725490196078f,0.5470588235294118f,0.5627450980392157f,0.5784313725490196f,0.5941176470588235f,0.6098039215686275f,0.6254901960784314f,0.6411764705882352f,0.6568627450980392f,0.6725490196078432f,0.6882352941176471f,0.7039215686274509f,0.7196078431372549f,0.7352941176470589f,0.7509803921568627f,0.7666666666666666f,0.7823529411764706f,0.7980392156862746f,0.8137254901960784f,0.8294117647058823f,0.8450980392156863f,0.8607843137254902f,0.8764705882352941f,0.892156862745098f,0.907843137254902f,0.9235294117647059f,0.9392156862745098f,0.9549019607843137f,0.9705882352941176f,0.9862745098039216f,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0.9941176470588236f,0.9784313725490197f,0.9627450980392158f,0.9470588235294117f,0.9313725490196079f,0.915686274509804f,0.8999999999999999f,0.884313725490196f,0.8686274509803922f,0.8529411764705883f,0.8372549019607844f,0.8215686274509804f,0.8058823529411765f,0.7901960784313726f,0.7745098039215685f,0.7588235294117647f,0.7431372549019608f,0.7274509803921569f,0.7117647058823531f,0.696078431372549f,0.6803921568627451f,0.6647058823529413f,0.6490196078431372f,0.6333333333333333f,0.6176470588235294f,0.6019607843137256f,0.5862745098039217f,0.5705882352941176f,0.5549019607843138f,0.5392156862745099f,0.5235294117647058f,0.5078431372549019f,0.4921568627450981f,0.4764705882352942f,0.4607843137254903f,0.4450980392156865f,0.4294117647058826f,0.4137254901960783f,0.3980392156862744f,0.3823529411764706f,0.3666666666666667f,0.3509803921568628f,0.335294117647059f,0.3196078431372551f,0.3039215686274508f,0.2882352941176469f,0.2725490196078431f,0.2568627450980392f,0.2411764705882353f,0.2254901960784315f,0.2098039215686276f,0.1941176470588237f,0.1784313725490199f,0.1627450980392156f,0.1470588235294117f,0.1313725490196078f,0.115686274509804f,0.1000000000000001f,0.08431372549019622f,0.06862745098039236f,0.05294117647058805f,0.03725490196078418f,0.02156862745098032f,0.00588235294117645f,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // now build lookup table this->_lut = ColorMap::linear_colormap(X, Mat(256,1, CV_32FC1, r).clone(), // red @@ -266,9 +266,9 @@ namespace colormap } void init(int n) { - float r[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - float g[] = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}; - float b[] = {1.0, 0.95, 0.9, 0.85, 0.8, 0.75, 0.7, 0.65, 0.6, 0.55, 0.5}; + float r[] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; + float g[] = {0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f,}; + float b[] = {1.0, 0.95f, 0.9f, 0.85f, 0.8f, 0.75f, 0.7f, 0.65f, 0.6f, 0.55f, 0.5f}; Mat X = linspace(0,1,11); this->_lut = ColorMap::linear_colormap(X, Mat(11,1, CV_32FC1, r).clone(), // red @@ -290,9 +290,9 @@ namespace colormap } void init(int n) { - float r[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9365079365079367, 0.8571428571428572, 0.7777777777777777, 0.6984126984126986, 0.6190476190476191, 0.53968253968254, 0.4603174603174605, 0.3809523809523814, 0.3015873015873018, 0.2222222222222223, 0.1428571428571432, 0.06349206349206415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03174603174603208, 0.08465608465608465, 0.1375661375661377, 0.1904761904761907, 0.2433862433862437, 0.2962962962962963, 0.3492063492063493, 0.4021164021164023, 0.4550264550264553, 0.5079365079365079, 0.5608465608465609, 0.6137566137566139, 0.666666666666667}; - float g[] = { 0, 0.03968253968253968, 0.07936507936507936, 0.119047619047619, 0.1587301587301587, 0.1984126984126984, 0.2380952380952381, 0.2777777777777778, 0.3174603174603174, 0.3571428571428571, 0.3968253968253968, 0.4365079365079365, 0.4761904761904762, 0.5158730158730158, 0.5555555555555556, 0.5952380952380952, 0.6349206349206349, 0.6746031746031745, 0.7142857142857142, 0.753968253968254, 0.7936507936507936, 0.8333333333333333, 0.873015873015873, 0.9126984126984127, 0.9523809523809523, 0.992063492063492, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9841269841269842, 0.9047619047619047, 0.8253968253968256, 0.7460317460317465, 0.666666666666667, 0.587301587301587, 0.5079365079365079, 0.4285714285714288, 0.3492063492063493, 0.2698412698412698, 0.1904761904761907, 0.1111111111111116, 0.03174603174603208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - float b[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01587301587301582, 0.09523809523809534, 0.1746031746031744, 0.2539682539682535, 0.333333333333333, 0.412698412698413, 0.4920634920634921, 0.5714285714285712, 0.6507936507936507, 0.7301587301587302, 0.8095238095238093, 0.8888888888888884, 0.9682539682539679, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + float r[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9365079365079367f, 0.8571428571428572f, 0.7777777777777777f, 0.6984126984126986f, 0.6190476190476191f, 0.53968253968254f, 0.4603174603174605f, 0.3809523809523814f, 0.3015873015873018f, 0.2222222222222223f, 0.1428571428571432f, 0.06349206349206415f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03174603174603208f, 0.08465608465608465f, 0.1375661375661377f, 0.1904761904761907f, 0.2433862433862437f, 0.2962962962962963f, 0.3492063492063493f, 0.4021164021164023f, 0.4550264550264553f, 0.5079365079365079f, 0.5608465608465609f, 0.6137566137566139f, 0.666666666666667f}; + float g[] = { 0, 0.03968253968253968f, 0.07936507936507936f, 0.119047619047619f, 0.1587301587301587f, 0.1984126984126984f, 0.2380952380952381f, 0.2777777777777778f, 0.3174603174603174f, 0.3571428571428571f, 0.3968253968253968f, 0.4365079365079365f, 0.4761904761904762f, 0.5158730158730158f, 0.5555555555555556f, 0.5952380952380952f, 0.6349206349206349f, 0.6746031746031745f, 0.7142857142857142f, 0.753968253968254f, 0.7936507936507936f, 0.8333333333333333f, 0.873015873015873f, 0.9126984126984127f, 0.9523809523809523f, 0.992063492063492f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9841269841269842f, 0.9047619047619047f, 0.8253968253968256f, 0.7460317460317465f, 0.666666666666667f, 0.587301587301587f, 0.5079365079365079f, 0.4285714285714288f, 0.3492063492063493f, 0.2698412698412698f, 0.1904761904761907f, 0.1111111111111116f, 0.03174603174603208f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + float b[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01587301587301582f, 0.09523809523809534f, 0.1746031746031744f, 0.2539682539682535f, 0.333333333333333f, 0.412698412698413f, 0.4920634920634921f, 0.5714285714285712f, 0.6507936507936507f, 0.7301587301587302f, 0.8095238095238093f, 0.8888888888888884f, 0.9682539682539679f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; Mat X = linspace(0,1,64); this->_lut = ColorMap::linear_colormap(X, Mat(64,1, CV_32FC1, r).clone(), // red @@ -314,9 +314,9 @@ namespace colormap } void init(int n) { - float r[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.04761904761904762, 0.09523809523809523, 0.1428571428571428, 0.1904761904761905, 0.2380952380952381, 0.2857142857142857, 0.3333333333333333, 0.3809523809523809, 0.4285714285714285, 0.4761904761904762, 0.5238095238095238, 0.5714285714285714, 0.6190476190476191, 0.6666666666666666, 0.7142857142857143, 0.7619047619047619, 0.8095238095238095, 0.8571428571428571, 0.9047619047619048, 0.9523809523809523, 1}; - float g[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02380952380952381, 0.04761904761904762, 0.07142857142857142, 0.09523809523809523, 0.119047619047619, 0.1428571428571428, 0.1666666666666667, 0.1904761904761905, 0.2142857142857143, 0.2380952380952381, 0.2619047619047619, 0.2857142857142857, 0.3095238095238095, 0.3333333333333333, 0.3571428571428572, 0.3809523809523809, 0.4047619047619048, 0.4285714285714285, 0.4523809523809524, 0.4761904761904762, 0.5, 0.5238095238095238, 0.5476190476190477, 0.5714285714285714, 0.5952380952380952, 0.6190476190476191, 0.6428571428571429, 0.6666666666666666, 0.6904761904761905, 0.7142857142857143, 0.7380952380952381, 0.7619047619047619, 0.7857142857142857, 0.8095238095238095, 0.8333333333333334, 0.8571428571428571, 0.8809523809523809, 0.9047619047619048, 0.9285714285714286, 0.9523809523809523, 0.9761904761904762, 1}; - float b[] = { 0, 0.01587301587301587, 0.03174603174603174, 0.04761904761904762, 0.06349206349206349, 0.07936507936507936, 0.09523809523809523, 0.1111111111111111, 0.126984126984127, 0.1428571428571428, 0.1587301587301587, 0.1746031746031746, 0.1904761904761905, 0.2063492063492063, 0.2222222222222222, 0.2380952380952381, 0.253968253968254, 0.2698412698412698, 0.2857142857142857, 0.3015873015873016, 0.3174603174603174, 0.3333333333333333, 0.3492063492063492, 0.3650793650793651, 0.3809523809523809, 0.3968253968253968, 0.4126984126984127, 0.4285714285714285, 0.4444444444444444, 0.4603174603174603, 0.4761904761904762, 0.492063492063492, 0.5079365079365079, 0.5238095238095238, 0.5396825396825397, 0.5555555555555556, 0.5714285714285714, 0.5873015873015873, 0.6031746031746031, 0.6190476190476191, 0.6349206349206349, 0.6507936507936508, 0.6666666666666666, 0.6825396825396826, 0.6984126984126984, 0.7142857142857143, 0.7301587301587301, 0.746031746031746, 0.7619047619047619, 0.7777777777777778, 0.7936507936507936, 0.8095238095238095, 0.8253968253968254, 0.8412698412698413, 0.8571428571428571, 0.873015873015873, 0.8888888888888888, 0.9047619047619048, 0.9206349206349206, 0.9365079365079365, 0.9523809523809523, 0.9682539682539683, 0.9841269841269841, 1}; + float r[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.04761904761904762f, 0.09523809523809523f, 0.1428571428571428f, 0.1904761904761905f, 0.2380952380952381f, 0.2857142857142857f, 0.3333333333333333f, 0.3809523809523809f, 0.4285714285714285f, 0.4761904761904762f, 0.5238095238095238f, 0.5714285714285714f, 0.6190476190476191f, 0.6666666666666666f, 0.7142857142857143f, 0.7619047619047619f, 0.8095238095238095f, 0.8571428571428571f, 0.9047619047619048f, 0.9523809523809523f, 1}; + float g[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02380952380952381f, 0.04761904761904762f, 0.07142857142857142f, 0.09523809523809523f, 0.119047619047619f, 0.1428571428571428f, 0.1666666666666667f, 0.1904761904761905f, 0.2142857142857143f, 0.2380952380952381f, 0.2619047619047619f, 0.2857142857142857f, 0.3095238095238095f, 0.3333333333333333f, 0.3571428571428572f, 0.3809523809523809f, 0.4047619047619048f, 0.4285714285714285f, 0.4523809523809524f, 0.4761904761904762f, 0.5f, 0.5238095238095238f, 0.5476190476190477f, 0.5714285714285714f, 0.5952380952380952f, 0.6190476190476191f, 0.6428571428571429f, 0.6666666666666666f, 0.6904761904761905f, 0.7142857142857143f, 0.7380952380952381f, 0.7619047619047619f, 0.7857142857142857f, 0.8095238095238095f, 0.8333333333333334f, 0.8571428571428571f, 0.8809523809523809f, 0.9047619047619048f, 0.9285714285714286f, 0.9523809523809523f, 0.9761904761904762f, 1}; + float b[] = { 0, 0.01587301587301587f, 0.03174603174603174f, 0.04761904761904762f, 0.06349206349206349f, 0.07936507936507936f, 0.09523809523809523f, 0.1111111111111111f, 0.126984126984127f, 0.1428571428571428f, 0.1587301587301587f, 0.1746031746031746f, 0.1904761904761905f, 0.2063492063492063f, 0.2222222222222222f, 0.2380952380952381f, 0.253968253968254f, 0.2698412698412698f, 0.2857142857142857f, 0.3015873015873016f, 0.3174603174603174f, 0.3333333333333333f, 0.3492063492063492f, 0.3650793650793651f, 0.3809523809523809f, 0.3968253968253968f, 0.4126984126984127f, 0.4285714285714285f, 0.4444444444444444f, 0.4603174603174603f, 0.4761904761904762f, 0.492063492063492f, 0.5079365079365079f, 0.5238095238095238f, 0.5396825396825397f, 0.5555555555555556f, 0.5714285714285714f, 0.5873015873015873f, 0.6031746031746031f, 0.6190476190476191f, 0.6349206349206349f, 0.6507936507936508f, 0.6666666666666666f, 0.6825396825396826f, 0.6984126984126984f, 0.7142857142857143f, 0.7301587301587301f, 0.746031746031746f, 0.7619047619047619f, 0.7777777777777778f, 0.7936507936507936f, 0.8095238095238095f, 0.8253968253968254f, 0.8412698412698413f, 0.8571428571428571f, 0.873015873015873f, 0.8888888888888888f, 0.9047619047619048f, 0.9206349206349206f, 0.9365079365079365f, 0.9523809523809523f, 0.9682539682539683f, 0.9841269841269841f, 1}; Mat X = linspace(0,1,64); this->_lut = ColorMap::linear_colormap(X, Mat(64,1, CV_32FC1, r).clone(), // red @@ -338,9 +338,9 @@ namespace colormap } void init(int n) { - float r[] = { 0, 0.01587301587301587, 0.03174603174603174, 0.04761904761904762, 0.06349206349206349, 0.07936507936507936, 0.09523809523809523, 0.1111111111111111, 0.126984126984127, 0.1428571428571428, 0.1587301587301587, 0.1746031746031746, 0.1904761904761905, 0.2063492063492063, 0.2222222222222222, 0.2380952380952381, 0.253968253968254, 0.2698412698412698, 0.2857142857142857, 0.3015873015873016, 0.3174603174603174, 0.3333333333333333, 0.3492063492063492, 0.3650793650793651, 0.3809523809523809, 0.3968253968253968, 0.4126984126984127, 0.4285714285714285, 0.4444444444444444, 0.4603174603174603, 0.4761904761904762, 0.492063492063492, 0.5079365079365079, 0.5238095238095238, 0.5396825396825397, 0.5555555555555556, 0.5714285714285714, 0.5873015873015873, 0.6031746031746031, 0.6190476190476191, 0.6349206349206349, 0.6507936507936508, 0.6666666666666666, 0.6825396825396826, 0.6984126984126984, 0.7142857142857143, 0.7301587301587301, 0.746031746031746, 0.7619047619047619, 0.7777777777777778, 0.7936507936507936, 0.8095238095238095, 0.8253968253968254, 0.8412698412698413, 0.8571428571428571, 0.873015873015873, 0.8888888888888888, 0.9047619047619048, 0.9206349206349206, 0.9365079365079365, 0.9523809523809523, 0.9682539682539683, 0.9841269841269841, 1}; - float g[] = { 0.5, 0.5079365079365079, 0.5158730158730158, 0.5238095238095238, 0.5317460317460317, 0.5396825396825397, 0.5476190476190477, 0.5555555555555556, 0.5634920634920635, 0.5714285714285714, 0.5793650793650793, 0.5873015873015873, 0.5952380952380952, 0.6031746031746031, 0.6111111111111112, 0.6190476190476191, 0.626984126984127, 0.6349206349206349, 0.6428571428571428, 0.6507936507936508, 0.6587301587301587, 0.6666666666666666, 0.6746031746031746, 0.6825396825396826, 0.6904761904761905, 0.6984126984126984, 0.7063492063492063, 0.7142857142857143, 0.7222222222222222, 0.7301587301587301, 0.7380952380952381, 0.746031746031746, 0.753968253968254, 0.7619047619047619, 0.7698412698412698, 0.7777777777777778, 0.7857142857142857, 0.7936507936507937, 0.8015873015873016, 0.8095238095238095, 0.8174603174603174, 0.8253968253968254, 0.8333333333333333, 0.8412698412698413, 0.8492063492063492, 0.8571428571428572, 0.8650793650793651, 0.873015873015873, 0.8809523809523809, 0.8888888888888888, 0.8968253968253967, 0.9047619047619048, 0.9126984126984127, 0.9206349206349207, 0.9285714285714286, 0.9365079365079365, 0.9444444444444444, 0.9523809523809523, 0.9603174603174602, 0.9682539682539683, 0.9761904761904762, 0.9841269841269842, 0.9920634920634921, 1}; - float b[] = { 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4}; + float r[] = { 0, 0.01587301587301587f, 0.03174603174603174f, 0.04761904761904762f, 0.06349206349206349f, 0.07936507936507936f, 0.09523809523809523f, 0.1111111111111111f, 0.126984126984127f, 0.1428571428571428f, 0.1587301587301587f, 0.1746031746031746f, 0.1904761904761905f, 0.2063492063492063f, 0.2222222222222222f, 0.2380952380952381f, 0.253968253968254f, 0.2698412698412698f, 0.2857142857142857f, 0.3015873015873016f, 0.3174603174603174f, 0.3333333333333333f, 0.3492063492063492f, 0.3650793650793651f, 0.3809523809523809f, 0.3968253968253968f, 0.4126984126984127f, 0.4285714285714285f, 0.4444444444444444f, 0.4603174603174603f, 0.4761904761904762f, 0.492063492063492f, 0.5079365079365079f, 0.5238095238095238f, 0.5396825396825397f, 0.5555555555555556f, 0.5714285714285714f, 0.5873015873015873f, 0.6031746031746031f, 0.6190476190476191f, 0.6349206349206349f, 0.6507936507936508f, 0.6666666666666666f, 0.6825396825396826f, 0.6984126984126984f, 0.7142857142857143f, 0.7301587301587301f, 0.746031746031746f, 0.7619047619047619f, 0.7777777777777778f, 0.7936507936507936f, 0.8095238095238095f, 0.8253968253968254f, 0.8412698412698413f, 0.8571428571428571f, 0.873015873015873f, 0.8888888888888888f, 0.9047619047619048f, 0.9206349206349206f, 0.9365079365079365f, 0.9523809523809523f, 0.9682539682539683f, 0.9841269841269841f, 1}; + float g[] = { 0.5f, 0.5079365079365079f, 0.5158730158730158f, 0.5238095238095238f, 0.5317460317460317f, 0.5396825396825397f, 0.5476190476190477f, 0.5555555555555556f, 0.5634920634920635f, 0.5714285714285714f, 0.5793650793650793f, 0.5873015873015873f, 0.5952380952380952f, 0.6031746031746031f, 0.6111111111111112f, 0.6190476190476191f, 0.626984126984127f, 0.6349206349206349f, 0.6428571428571428f, 0.6507936507936508f, 0.6587301587301587f, 0.6666666666666666f, 0.6746031746031746f, 0.6825396825396826f, 0.6904761904761905f, 0.6984126984126984f, 0.7063492063492063f, 0.7142857142857143f, 0.7222222222222222f, 0.7301587301587301f, 0.7380952380952381f, 0.746031746031746f, 0.753968253968254f, 0.7619047619047619f, 0.7698412698412698f, 0.7777777777777778f, 0.7857142857142857f, 0.7936507936507937f, 0.8015873015873016f, 0.8095238095238095f, 0.8174603174603174f, 0.8253968253968254f, 0.8333333333333333f, 0.8412698412698413f, 0.8492063492063492f, 0.8571428571428572f, 0.8650793650793651f, 0.873015873015873f, 0.8809523809523809f, 0.8888888888888888f, 0.8968253968253967f, 0.9047619047619048f, 0.9126984126984127f, 0.9206349206349207f, 0.9285714285714286f, 0.9365079365079365f, 0.9444444444444444f, 0.9523809523809523f, 0.9603174603174602f, 0.9682539682539683f, 0.9761904761904762f, 0.9841269841269842f, 0.9920634920634921f, 1}; + float b[] = { 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f}; Mat X = linspace(0,1,64); this->_lut = ColorMap::linear_colormap(X, Mat(64,1, CV_32FC1, r).clone(), // red @@ -363,8 +363,8 @@ namespace colormap void init(int n) { float r[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - float g[] = { 0, 0.01587301587301587, 0.03174603174603174, 0.04761904761904762, 0.06349206349206349, 0.07936507936507936, 0.09523809523809523, 0.1111111111111111, 0.126984126984127, 0.1428571428571428, 0.1587301587301587, 0.1746031746031746, 0.1904761904761905, 0.2063492063492063, 0.2222222222222222, 0.2380952380952381, 0.253968253968254, 0.2698412698412698, 0.2857142857142857, 0.3015873015873016, 0.3174603174603174, 0.3333333333333333, 0.3492063492063492, 0.3650793650793651, 0.3809523809523809, 0.3968253968253968, 0.4126984126984127, 0.4285714285714285, 0.4444444444444444, 0.4603174603174603, 0.4761904761904762, 0.492063492063492, 0.5079365079365079, 0.5238095238095238, 0.5396825396825397, 0.5555555555555556, 0.5714285714285714, 0.5873015873015873, 0.6031746031746031, 0.6190476190476191, 0.6349206349206349, 0.6507936507936508, 0.6666666666666666, 0.6825396825396826, 0.6984126984126984, 0.7142857142857143, 0.7301587301587301, 0.746031746031746, 0.7619047619047619, 0.7777777777777778, 0.7936507936507936, 0.8095238095238095, 0.8253968253968254, 0.8412698412698413, 0.8571428571428571, 0.873015873015873, 0.8888888888888888, 0.9047619047619048, 0.9206349206349206, 0.9365079365079365, 0.9523809523809523, 0.9682539682539683, 0.9841269841269841, 1}; - float b[] = { 1, 0.9841269841269842, 0.9682539682539683, 0.9523809523809523, 0.9365079365079365, 0.9206349206349207, 0.9047619047619048, 0.8888888888888888, 0.873015873015873, 0.8571428571428572, 0.8412698412698413, 0.8253968253968254, 0.8095238095238095, 0.7936507936507937, 0.7777777777777778, 0.7619047619047619, 0.746031746031746, 0.7301587301587302, 0.7142857142857143, 0.6984126984126984, 0.6825396825396826, 0.6666666666666667, 0.6507936507936508, 0.6349206349206349, 0.6190476190476191, 0.6031746031746033, 0.5873015873015873, 0.5714285714285714, 0.5555555555555556, 0.5396825396825398, 0.5238095238095238, 0.5079365079365079, 0.4920634920634921, 0.4761904761904762, 0.4603174603174603, 0.4444444444444444, 0.4285714285714286, 0.4126984126984127, 0.3968253968253969, 0.3809523809523809, 0.3650793650793651, 0.3492063492063492, 0.3333333333333334, 0.3174603174603174, 0.3015873015873016, 0.2857142857142857, 0.2698412698412699, 0.253968253968254, 0.2380952380952381, 0.2222222222222222, 0.2063492063492064, 0.1904761904761905, 0.1746031746031746, 0.1587301587301587, 0.1428571428571429, 0.126984126984127, 0.1111111111111112, 0.09523809523809523, 0.07936507936507942, 0.06349206349206349, 0.04761904761904767, 0.03174603174603174, 0.01587301587301593, 0}; + float g[] = { 0, 0.01587301587301587f, 0.03174603174603174f, 0.04761904761904762f, 0.06349206349206349f, 0.07936507936507936f, 0.09523809523809523f, 0.1111111111111111f, 0.126984126984127f, 0.1428571428571428f, 0.1587301587301587f, 0.1746031746031746f, 0.1904761904761905f, 0.2063492063492063f, 0.2222222222222222f, 0.2380952380952381f, 0.253968253968254f, 0.2698412698412698f, 0.2857142857142857f, 0.3015873015873016f, 0.3174603174603174f, 0.3333333333333333f, 0.3492063492063492f, 0.3650793650793651f, 0.3809523809523809f, 0.3968253968253968f, 0.4126984126984127f, 0.4285714285714285f, 0.4444444444444444f, 0.4603174603174603f, 0.4761904761904762f, 0.492063492063492f, 0.5079365079365079f, 0.5238095238095238f, 0.5396825396825397f, 0.5555555555555556f, 0.5714285714285714f, 0.5873015873015873f, 0.6031746031746031f, 0.6190476190476191f, 0.6349206349206349f, 0.6507936507936508f, 0.6666666666666666f, 0.6825396825396826f, 0.6984126984126984f, 0.7142857142857143f, 0.7301587301587301f, 0.746031746031746f, 0.7619047619047619f, 0.7777777777777778f, 0.7936507936507936f, 0.8095238095238095f, 0.8253968253968254f, 0.8412698412698413f, 0.8571428571428571f, 0.873015873015873f, 0.8888888888888888f, 0.9047619047619048f, 0.9206349206349206f, 0.9365079365079365f, 0.9523809523809523f, 0.9682539682539683f, 0.9841269841269841f, 1}; + float b[] = { 1, 0.9841269841269842f, 0.9682539682539683f, 0.9523809523809523f, 0.9365079365079365f, 0.9206349206349207f, 0.9047619047619048f, 0.8888888888888888f, 0.873015873015873f, 0.8571428571428572f, 0.8412698412698413f, 0.8253968253968254f, 0.8095238095238095f, 0.7936507936507937f, 0.7777777777777778f, 0.7619047619047619f, 0.746031746031746f, 0.7301587301587302f, 0.7142857142857143f, 0.6984126984126984f, 0.6825396825396826f, 0.6666666666666667f, 0.6507936507936508f, 0.6349206349206349f, 0.6190476190476191f, 0.6031746031746033f, 0.5873015873015873f, 0.5714285714285714f, 0.5555555555555556f, 0.5396825396825398f, 0.5238095238095238f, 0.5079365079365079f, 0.4920634920634921f, 0.4761904761904762f, 0.4603174603174603f, 0.4444444444444444f, 0.4285714285714286f, 0.4126984126984127f, 0.3968253968253969f, 0.3809523809523809f, 0.3650793650793651f, 0.3492063492063492f, 0.3333333333333334f, 0.3174603174603174f, 0.3015873015873016f, 0.2857142857142857f, 0.2698412698412699f, 0.253968253968254f, 0.2380952380952381f, 0.2222222222222222f, 0.2063492063492064f, 0.1904761904761905f, 0.1746031746031746f, 0.1587301587301587f, 0.1428571428571429f, 0.126984126984127f, 0.1111111111111112f, 0.09523809523809523f, 0.07936507936507942f, 0.06349206349206349f, 0.04761904761904767f, 0.03174603174603174f, 0.01587301587301593f, 0}; Mat X = linspace(0,1,64); this->_lut = ColorMap::linear_colormap(X, Mat(64,1, CV_32FC1, r).clone(), // red @@ -386,8 +386,8 @@ namespace colormap } void init(int n) { - float r[] = { 0, 0.01587301587301587, 0.03174603174603174, 0.04761904761904762, 0.06349206349206349, 0.07936507936507936, 0.09523809523809523, 0.1111111111111111, 0.126984126984127, 0.1428571428571428, 0.1587301587301587, 0.1746031746031746, 0.1904761904761905, 0.2063492063492063, 0.2222222222222222, 0.2380952380952381, 0.253968253968254, 0.2698412698412698, 0.2857142857142857, 0.3015873015873016, 0.3174603174603174, 0.3333333333333333, 0.3492063492063492, 0.3650793650793651, 0.3809523809523809, 0.3968253968253968, 0.4126984126984127, 0.4285714285714285, 0.4444444444444444, 0.4603174603174603, 0.4761904761904762, 0.492063492063492, 0.5079365079365079, 0.5238095238095238, 0.5396825396825397, 0.5555555555555556, 0.5714285714285714, 0.5873015873015873, 0.6031746031746031, 0.6190476190476191, 0.6349206349206349, 0.6507936507936508, 0.6666666666666666, 0.6825396825396826, 0.6984126984126984, 0.7142857142857143, 0.7301587301587301, 0.746031746031746, 0.7619047619047619, 0.7777777777777778, 0.7936507936507936, 0.8095238095238095, 0.8253968253968254, 0.8412698412698413, 0.8571428571428571, 0.873015873015873, 0.8888888888888888, 0.9047619047619048, 0.9206349206349206, 0.9365079365079365, 0.9523809523809523, 0.9682539682539683, 0.9841269841269841, 1}; - float g[] = { 1, 0.9841269841269842, 0.9682539682539683, 0.9523809523809523, 0.9365079365079365, 0.9206349206349207, 0.9047619047619048, 0.8888888888888888, 0.873015873015873, 0.8571428571428572, 0.8412698412698413, 0.8253968253968254, 0.8095238095238095, 0.7936507936507937, 0.7777777777777778, 0.7619047619047619, 0.746031746031746, 0.7301587301587302, 0.7142857142857143, 0.6984126984126984, 0.6825396825396826, 0.6666666666666667, 0.6507936507936508, 0.6349206349206349, 0.6190476190476191, 0.6031746031746033, 0.5873015873015873, 0.5714285714285714, 0.5555555555555556, 0.5396825396825398, 0.5238095238095238, 0.5079365079365079, 0.4920634920634921, 0.4761904761904762, 0.4603174603174603, 0.4444444444444444, 0.4285714285714286, 0.4126984126984127, 0.3968253968253969, 0.3809523809523809, 0.3650793650793651, 0.3492063492063492, 0.3333333333333334, 0.3174603174603174, 0.3015873015873016, 0.2857142857142857, 0.2698412698412699, 0.253968253968254, 0.2380952380952381, 0.2222222222222222, 0.2063492063492064, 0.1904761904761905, 0.1746031746031746, 0.1587301587301587, 0.1428571428571429, 0.126984126984127, 0.1111111111111112, 0.09523809523809523, 0.07936507936507942, 0.06349206349206349, 0.04761904761904767, 0.03174603174603174, 0.01587301587301593, 0}; + float r[] = { 0, 0.01587301587301587f, 0.03174603174603174f, 0.04761904761904762f, 0.06349206349206349f, 0.07936507936507936f, 0.09523809523809523f, 0.1111111111111111f, 0.126984126984127f, 0.1428571428571428f, 0.1587301587301587f, 0.1746031746031746f, 0.1904761904761905f, 0.2063492063492063f, 0.2222222222222222f, 0.2380952380952381f, 0.253968253968254f, 0.2698412698412698f, 0.2857142857142857f, 0.3015873015873016f, 0.3174603174603174f, 0.3333333333333333f, 0.3492063492063492f, 0.3650793650793651f, 0.3809523809523809f, 0.3968253968253968f, 0.4126984126984127f, 0.4285714285714285f, 0.4444444444444444f, 0.4603174603174603f, 0.4761904761904762f, 0.492063492063492f, 0.5079365079365079f, 0.5238095238095238f, 0.5396825396825397f, 0.5555555555555556f, 0.5714285714285714f, 0.5873015873015873f, 0.6031746031746031f, 0.6190476190476191f, 0.6349206349206349f, 0.6507936507936508f, 0.6666666666666666f, 0.6825396825396826f, 0.6984126984126984f, 0.7142857142857143f, 0.7301587301587301f, 0.746031746031746f, 0.7619047619047619f, 0.7777777777777778f, 0.7936507936507936f, 0.8095238095238095f, 0.8253968253968254f, 0.8412698412698413f, 0.8571428571428571f, 0.873015873015873f, 0.8888888888888888f, 0.9047619047619048f, 0.9206349206349206f, 0.9365079365079365f, 0.9523809523809523f, 0.9682539682539683f, 0.9841269841269841f, 1}; + float g[] = { 1, 0.9841269841269842f, 0.9682539682539683f, 0.9523809523809523f, 0.9365079365079365f, 0.9206349206349207f, 0.9047619047619048f, 0.8888888888888888f, 0.873015873015873f, 0.8571428571428572f, 0.8412698412698413f, 0.8253968253968254f, 0.8095238095238095f, 0.7936507936507937f, 0.7777777777777778f, 0.7619047619047619f, 0.746031746031746f, 0.7301587301587302f, 0.7142857142857143f, 0.6984126984126984f, 0.6825396825396826f, 0.6666666666666667f, 0.6507936507936508f, 0.6349206349206349f, 0.6190476190476191f, 0.6031746031746033f, 0.5873015873015873f, 0.5714285714285714f, 0.5555555555555556f, 0.5396825396825398f, 0.5238095238095238f, 0.5079365079365079f, 0.4920634920634921f, 0.4761904761904762f, 0.4603174603174603f, 0.4444444444444444f, 0.4285714285714286f, 0.4126984126984127f, 0.3968253968253969f, 0.3809523809523809f, 0.3650793650793651f, 0.3492063492063492f, 0.3333333333333334f, 0.3174603174603174f, 0.3015873015873016f, 0.2857142857142857f, 0.2698412698412699f, 0.253968253968254f, 0.2380952380952381f, 0.2222222222222222f, 0.2063492063492064f, 0.1904761904761905f, 0.1746031746031746f, 0.1587301587301587f, 0.1428571428571429f, 0.126984126984127f, 0.1111111111111112f, 0.09523809523809523f, 0.07936507936507942f, 0.06349206349206349f, 0.04761904761904767f, 0.03174603174603174f, 0.01587301587301593f, 0}; float b[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; Mat X = linspace(0,1,64); this->_lut = ColorMap::linear_colormap(X, @@ -410,9 +410,9 @@ namespace colormap } void init(int n) { - float r[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9523809523809526, 0.8571428571428568, 0.7619047619047614, 0.6666666666666665, 0.5714285714285716, 0.4761904761904763, 0.3809523809523805, 0.2857142857142856, 0.1904761904761907, 0.0952380952380949, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.09523809523809557, 0.1904761904761905, 0.2857142857142854, 0.3809523809523809, 0.4761904761904765, 0.5714285714285714, 0.6666666666666663, 0.7619047619047619, 0.8571428571428574, 0.9523809523809523, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - float g[] = { 0, 0.09523809523809523, 0.1904761904761905, 0.2857142857142857, 0.3809523809523809, 0.4761904761904762, 0.5714285714285714, 0.6666666666666666, 0.7619047619047619, 0.8571428571428571, 0.9523809523809523, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9523809523809526, 0.8571428571428577, 0.7619047619047619, 0.6666666666666665, 0.5714285714285716, 0.4761904761904767, 0.3809523809523814, 0.2857142857142856, 0.1904761904761907, 0.09523809523809579, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - float b[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.09523809523809523, 0.1904761904761905, 0.2857142857142857, 0.3809523809523809, 0.4761904761904762, 0.5714285714285714, 0.6666666666666666, 0.7619047619047619, 0.8571428571428571, 0.9523809523809523, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9523809523809526, 0.8571428571428577, 0.7619047619047614, 0.6666666666666665, 0.5714285714285716, 0.4761904761904767, 0.3809523809523805, 0.2857142857142856, 0.1904761904761907, 0.09523809523809579, 0}; + float r[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9523809523809526f, 0.8571428571428568f, 0.7619047619047614f, 0.6666666666666665f, 0.5714285714285716f, 0.4761904761904763f, 0.3809523809523805f, 0.2857142857142856f, 0.1904761904761907f, 0.0952380952380949f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.09523809523809557f, 0.1904761904761905f, 0.2857142857142854f, 0.3809523809523809f, 0.4761904761904765f, 0.5714285714285714f, 0.6666666666666663f, 0.7619047619047619f, 0.8571428571428574f, 0.9523809523809523f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + float g[] = { 0, 0.09523809523809523f, 0.1904761904761905f, 0.2857142857142857f, 0.3809523809523809f, 0.4761904761904762f, 0.5714285714285714f, 0.6666666666666666f, 0.7619047619047619f, 0.8571428571428571f, 0.9523809523809523f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9523809523809526f, 0.8571428571428577f, 0.7619047619047619f, 0.6666666666666665f, 0.5714285714285716f, 0.4761904761904767f, 0.3809523809523814f, 0.2857142857142856f, 0.1904761904761907f, 0.09523809523809579f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + float b[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.09523809523809523f, 0.1904761904761905f, 0.2857142857142857f, 0.3809523809523809f, 0.4761904761904762f, 0.5714285714285714f, 0.6666666666666666f, 0.7619047619047619f, 0.8571428571428571f, 0.9523809523809523f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9523809523809526f, 0.8571428571428577f, 0.7619047619047614f, 0.6666666666666665f, 0.5714285714285716f, 0.4761904761904767f, 0.3809523809523805f, 0.2857142857142856f, 0.1904761904761907f, 0.09523809523809579f, 0}; Mat X = linspace(0,1,64); this->_lut = ColorMap::linear_colormap(X, Mat(64,1, CV_32FC1, r).clone(), // red @@ -434,9 +434,9 @@ namespace colormap } void init(int n) { - float r[] = { 0, 0.1571348402636772, 0.2222222222222222, 0.2721655269759087, 0.3142696805273544, 0.3513641844631533, 0.3849001794597505, 0.415739709641549, 0.4444444444444444, 0.4714045207910317, 0.4969039949999532, 0.5211573066470477, 0.5443310539518174, 0.5665577237325317, 0.5879447357921312, 0.6085806194501846, 0.6285393610547089, 0.6478835438717, 0.6666666666666666, 0.6849348892187751, 0.7027283689263065, 0.7200822998230956, 0.7370277311900888, 0.753592220347252, 0.7663560447348133, 0.7732293307186413, 0.7800420555749596, 0.7867957924694432, 0.7934920476158722, 0.8001322641986387, 0.8067178260046388, 0.8132500607904444, 0.8197302434079591, 0.8261595987094034, 0.8325393042503717, 0.8388704928078611, 0.8451542547285166, 0.8513916401208816, 0.8575836609041332, 0.8637312927246217, 0.8698354767504924, 0.8758971213537393, 0.8819171036881968, 0.8878962711712378, 0.8938354428762595, 0.8997354108424372, 0.9055969413076769, 0.9114207758701963, 0.9172076325837248, 0.9229582069908971, 0.9286731730990523, 0.9343531843023135, 0.9399988742535192, 0.9456108576893002, 0.9511897312113418, 0.9567360740266436, 0.9622504486493763, 0.9677334015667416, 0.9731854638710686, 0.9786071518602129, 0.9839989676081821, 0.9893613995077727, 0.9946949227868761, 1}; - float g[] = { 0, 0.1028688999747279, 0.1454785934906616, 0.1781741612749496, 0.2057377999494559, 0.2300218531141181, 0.2519763153394848, 0.2721655269759087, 0.2909571869813232, 0.3086066999241838, 0.3253000243161777, 0.3411775438127727, 0.3563483225498992, 0.3708990935094579, 0.3849001794597505, 0.3984095364447979, 0.4114755998989117, 0.4241393401869012, 0.4364357804719847, 0.4483951394230328, 0.4600437062282361, 0.4714045207910317, 0.4824979096371639, 0.4933419132673033, 0.5091750772173156, 0.5328701692569688, 0.5555555555555556, 0.5773502691896257, 0.5983516452371671, 0.6186404847588913, 0.6382847385042254, 0.6573421981221795, 0.6758625033664688, 0.6938886664887108, 0.7114582486036499, 0.7286042804780002, 0.7453559924999299, 0.7617394000445604, 0.7777777777777778, 0.7934920476158723, 0.8089010988089465, 0.8240220541217402, 0.8388704928078611, 0.8534606386520677, 0.8678055195451838, 0.8819171036881968, 0.8958064164776166, 0.9094836413191612, 0.9172076325837248, 0.9229582069908971, 0.9286731730990523, 0.9343531843023135, 0.9399988742535192, 0.9456108576893002, 0.9511897312113418, 0.9567360740266436, 0.9622504486493763, 0.9677334015667416, 0.9731854638710686, 0.9786071518602129, 0.9839989676081821, 0.9893613995077727, 0.9946949227868761, 1}; - float b[] = { 0, 0.1028688999747279, 0.1454785934906616, 0.1781741612749496, 0.2057377999494559, 0.2300218531141181, 0.2519763153394848, 0.2721655269759087, 0.2909571869813232, 0.3086066999241838, 0.3253000243161777, 0.3411775438127727, 0.3563483225498992, 0.3708990935094579, 0.3849001794597505, 0.3984095364447979, 0.4114755998989117, 0.4241393401869012, 0.4364357804719847, 0.4483951394230328, 0.4600437062282361, 0.4714045207910317, 0.4824979096371639, 0.4933419132673033, 0.5039526306789697, 0.5143444998736397, 0.5245305283129621, 0.5345224838248488, 0.5443310539518174, 0.5539659798925444, 0.563436169819011, 0.5727497953228163, 0.5819143739626463, 0.5909368402852788, 0.5998236072282915, 0.6085806194501846, 0.6172133998483676, 0.6257270902992705, 0.6341264874742278, 0.642416074439621, 0.6506000486323554, 0.6586823467062358, 0.6666666666666666, 0.6745564876468501, 0.6823550876255453, 0.6900655593423541, 0.6976908246297114, 0.7052336473499384, 0.7237468644557459, 0.7453559924999298, 0.7663560447348133, 0.7867957924694432, 0.8067178260046388, 0.8261595987094034, 0.8451542547285166, 0.8637312927246217, 0.8819171036881968, 0.8997354108424372, 0.9172076325837248, 0.9343531843023135, 0.9511897312113418, 0.9677334015667416, 0.9839989676081821, 1}; + float r[] = { 0, 0.1571348402636772f, 0.2222222222222222f, 0.2721655269759087f, 0.3142696805273544f, 0.3513641844631533f, 0.3849001794597505f, 0.415739709641549f, 0.4444444444444444f, 0.4714045207910317f, 0.4969039949999532f, 0.5211573066470477f, 0.5443310539518174f, 0.5665577237325317f, 0.5879447357921312f, 0.6085806194501846f, 0.6285393610547089f, 0.6478835438717f, 0.6666666666666666f, 0.6849348892187751f, 0.7027283689263065f, 0.7200822998230956f, 0.7370277311900888f, 0.753592220347252f, 0.7663560447348133f, 0.7732293307186413f, 0.7800420555749596f, 0.7867957924694432f, 0.7934920476158722f, 0.8001322641986387f, 0.8067178260046388f, 0.8132500607904444f, 0.8197302434079591f, 0.8261595987094034f, 0.8325393042503717f, 0.8388704928078611f, 0.8451542547285166f, 0.8513916401208816f, 0.8575836609041332f, 0.8637312927246217f, 0.8698354767504924f, 0.8758971213537393f, 0.8819171036881968f, 0.8878962711712378f, 0.8938354428762595f, 0.8997354108424372f, 0.9055969413076769f, 0.9114207758701963f, 0.9172076325837248f, 0.9229582069908971f, 0.9286731730990523f, 0.9343531843023135f, 0.9399988742535192f, 0.9456108576893002f, 0.9511897312113418f, 0.9567360740266436f, 0.9622504486493763f, 0.9677334015667416f, 0.9731854638710686f, 0.9786071518602129f, 0.9839989676081821f, 0.9893613995077727f, 0.9946949227868761f, 1}; + float g[] = { 0, 0.1028688999747279f, 0.1454785934906616f, 0.1781741612749496f, 0.2057377999494559f, 0.2300218531141181f, 0.2519763153394848f, 0.2721655269759087f, 0.2909571869813232f, 0.3086066999241838f, 0.3253000243161777f, 0.3411775438127727f, 0.3563483225498992f, 0.3708990935094579f, 0.3849001794597505f, 0.3984095364447979f, 0.4114755998989117f, 0.4241393401869012f, 0.4364357804719847f, 0.4483951394230328f, 0.4600437062282361f, 0.4714045207910317f, 0.4824979096371639f, 0.4933419132673033f, 0.5091750772173156f, 0.5328701692569688f, 0.5555555555555556f, 0.5773502691896257f, 0.5983516452371671f, 0.6186404847588913f, 0.6382847385042254f, 0.6573421981221795f, 0.6758625033664688f, 0.6938886664887108f, 0.7114582486036499f, 0.7286042804780002f, 0.7453559924999299f, 0.7617394000445604f, 0.7777777777777778f, 0.7934920476158723f, 0.8089010988089465f, 0.8240220541217402f, 0.8388704928078611f, 0.8534606386520677f, 0.8678055195451838f, 0.8819171036881968f, 0.8958064164776166f, 0.9094836413191612f, 0.9172076325837248f, 0.9229582069908971f, 0.9286731730990523f, 0.9343531843023135f, 0.9399988742535192f, 0.9456108576893002f, 0.9511897312113418f, 0.9567360740266436f, 0.9622504486493763f, 0.9677334015667416f, 0.9731854638710686f, 0.9786071518602129f, 0.9839989676081821f, 0.9893613995077727f, 0.9946949227868761f, 1}; + float b[] = { 0, 0.1028688999747279f, 0.1454785934906616f, 0.1781741612749496f, 0.2057377999494559f, 0.2300218531141181f, 0.2519763153394848f, 0.2721655269759087f, 0.2909571869813232f, 0.3086066999241838f, 0.3253000243161777f, 0.3411775438127727f, 0.3563483225498992f, 0.3708990935094579f, 0.3849001794597505f, 0.3984095364447979f, 0.4114755998989117f, 0.4241393401869012f, 0.4364357804719847f, 0.4483951394230328f, 0.4600437062282361f, 0.4714045207910317f, 0.4824979096371639f, 0.4933419132673033f, 0.5039526306789697f, 0.5143444998736397f, 0.5245305283129621f, 0.5345224838248488f, 0.5443310539518174f, 0.5539659798925444f, 0.563436169819011f, 0.5727497953228163f, 0.5819143739626463f, 0.5909368402852788f, 0.5998236072282915f, 0.6085806194501846f, 0.6172133998483676f, 0.6257270902992705f, 0.6341264874742278f, 0.642416074439621f, 0.6506000486323554f, 0.6586823467062358f, 0.6666666666666666f, 0.6745564876468501f, 0.6823550876255453f, 0.6900655593423541f, 0.6976908246297114f, 0.7052336473499384f, 0.7237468644557459f, 0.7453559924999298f, 0.7663560447348133f, 0.7867957924694432f, 0.8067178260046388f, 0.8261595987094034f, 0.8451542547285166f, 0.8637312927246217f, 0.8819171036881968f, 0.8997354108424372f, 0.9172076325837248f, 0.9343531843023135f, 0.9511897312113418f, 0.9677334015667416f, 0.9839989676081821f, 1}; Mat X = linspace(0,1,64); this->_lut = ColorMap::linear_colormap(X, Mat(64,1, CV_32FC1, r).clone(), // red @@ -458,9 +458,9 @@ namespace colormap } void init(int n) { - float r[] = { 0, 0.03968253968253968, 0.07936507936507936, 0.119047619047619, 0.1587301587301587, 0.1984126984126984, 0.2380952380952381, 0.2777777777777778, 0.3174603174603174, 0.3571428571428571, 0.3968253968253968, 0.4365079365079365, 0.4761904761904762, 0.5158730158730158, 0.5555555555555556, 0.5952380952380952, 0.6349206349206349, 0.6746031746031745, 0.7142857142857142, 0.753968253968254, 0.7936507936507936, 0.8333333333333333, 0.873015873015873, 0.9126984126984127, 0.9523809523809523, 0.992063492063492, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - float g[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03174603174603163, 0.0714285714285714, 0.1111111111111112, 0.1507936507936507, 0.1904761904761905, 0.23015873015873, 0.2698412698412698, 0.3095238095238093, 0.3492063492063491, 0.3888888888888888, 0.4285714285714284, 0.4682539682539679, 0.5079365079365079, 0.5476190476190477, 0.5873015873015872, 0.6269841269841268, 0.6666666666666665, 0.7063492063492065, 0.746031746031746, 0.7857142857142856, 0.8253968253968254, 0.8650793650793651, 0.9047619047619047, 0.9444444444444442, 0.984126984126984, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - float b[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.04761904761904745, 0.1269841269841265, 0.2063492063492056, 0.2857142857142856, 0.3650793650793656, 0.4444444444444446, 0.5238095238095237, 0.6031746031746028, 0.6825396825396828, 0.7619047619047619, 0.8412698412698409, 0.92063492063492, 1}; + float r[] = { 0, 0.03968253968253968f, 0.07936507936507936f, 0.119047619047619f, 0.1587301587301587f, 0.1984126984126984f, 0.2380952380952381f, 0.2777777777777778f, 0.3174603174603174f, 0.3571428571428571f, 0.3968253968253968f, 0.4365079365079365f, 0.4761904761904762f, 0.5158730158730158f, 0.5555555555555556f, 0.5952380952380952f, 0.6349206349206349f, 0.6746031746031745f, 0.7142857142857142f, 0.753968253968254f, 0.7936507936507936f, 0.8333333333333333f, 0.873015873015873f, 0.9126984126984127f, 0.9523809523809523f, 0.992063492063492f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + float g[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03174603174603163f, 0.0714285714285714f, 0.1111111111111112f, 0.1507936507936507f, 0.1904761904761905f, 0.23015873015873f, 0.2698412698412698f, 0.3095238095238093f, 0.3492063492063491f, 0.3888888888888888f, 0.4285714285714284f, 0.4682539682539679f, 0.5079365079365079f, 0.5476190476190477f, 0.5873015873015872f, 0.6269841269841268f, 0.6666666666666665f, 0.7063492063492065f, 0.746031746031746f, 0.7857142857142856f, 0.8253968253968254f, 0.8650793650793651f, 0.9047619047619047f, 0.9444444444444442f, 0.984126984126984f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + float b[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.04761904761904745f, 0.1269841269841265f, 0.2063492063492056f, 0.2857142857142856f, 0.3650793650793656f, 0.4444444444444446f, 0.5238095238095237f, 0.6031746031746028f, 0.6825396825396828f, 0.7619047619047619f, 0.8412698412698409f, 0.92063492063492f, 1}; Mat X = linspace(0,1,64); this->_lut = ColorMap::linear_colormap(X, Mat(64,1, CV_32FC1, r).clone(), // red diff --git a/modules/gpu/perf/perf_calib3d.cpp b/modules/gpu/perf/perf_calib3d.cpp index 58e43eb34..e56bbd683 100644 --- a/modules/gpu/perf/perf_calib3d.cpp +++ b/modules/gpu/perf/perf_calib3d.cpp @@ -41,6 +41,7 @@ //M*/ #include "perf_precomp.hpp" +#include "perf_util.hpp" using namespace std; using namespace testing; diff --git a/modules/gpu/perf/perf_core.cpp b/modules/gpu/perf/perf_core.cpp index 371d2869a..806773b1a 100644 --- a/modules/gpu/perf/perf_core.cpp +++ b/modules/gpu/perf/perf_core.cpp @@ -41,6 +41,7 @@ //M*/ #include "perf_precomp.hpp" +#include "perf_util.hpp" using namespace std; using namespace testing; diff --git a/modules/gpu/perf/perf_filters.cpp b/modules/gpu/perf/perf_filters.cpp index f064dd395..81984f2a3 100644 --- a/modules/gpu/perf/perf_filters.cpp +++ b/modules/gpu/perf/perf_filters.cpp @@ -41,6 +41,7 @@ //M*/ #include "perf_precomp.hpp" +#include "perf_util.hpp" using namespace std; using namespace testing; diff --git a/modules/gpu/perf/perf_imgproc.cpp b/modules/gpu/perf/perf_imgproc.cpp index f2762e07c..8ff0a5ead 100644 --- a/modules/gpu/perf/perf_imgproc.cpp +++ b/modules/gpu/perf/perf_imgproc.cpp @@ -41,6 +41,7 @@ //M*/ #include "perf_precomp.hpp" +#include "perf_util.hpp" using namespace std; using namespace testing; diff --git a/modules/gpu/perf/perf_matop.cpp b/modules/gpu/perf/perf_matop.cpp index f80ba1b08..352a62070 100644 --- a/modules/gpu/perf/perf_matop.cpp +++ b/modules/gpu/perf/perf_matop.cpp @@ -41,6 +41,7 @@ //M*/ #include "perf_precomp.hpp" +#include "perf_util.hpp" using namespace std; using namespace testing; diff --git a/modules/gpu/perf/perf_util.hpp b/modules/gpu/perf/perf_util.hpp new file mode 100644 index 000000000..855da4d26 --- /dev/null +++ b/modules/gpu/perf/perf_util.hpp @@ -0,0 +1,53 @@ +/*M/////////////////////////////////////////////////////////////////////////////////////// +// +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. +// +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. +// +// +// License Agreement +// For Open Source Computer Vision Library +// +// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. +// Copyright (C) 2009, Willow Garage Inc., all rights reserved. +// Third party copyrights are property of their respective owners. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistribution's of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution's in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * The name of the copyright holders may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// This software is provided by the copyright holders and contributors "as is" and +// any express or implied warranties, including, but not limited to, the implied +// warranties of merchantability and fitness for a particular purpose are disclaimed. +// In no event shall the Intel Corporation or contributors be liable for any direct, +// indirect, incidental, special, exemplary, or consequential damages +// (including, but not limited to, procurement of substitute goods or services; +// loss of use, data, or profits; or business interruption) however caused +// and on any theory of liability, whether in contract, strict liability, +// or tort (including negligence or otherwise) arising in any way out of +// the use of this software, even if advised of the possibility of such damage. +// +//M*/ + +#ifndef __OPENCV_PERF_UTIL_HPP__ +#define __OPENCV_PERF_UTIL_HPP__ + +namespace perf { +DEF_PARAM_TEST_1(Sz, cv::Size); +typedef ::perf::Size_MatType Sz_Type; +DEF_PARAM_TEST(Sz_Depth, cv::Size, ::perf::MatDepth); +DEF_PARAM_TEST(Sz_Depth_Cn, cv::Size, ::perf::MatDepth, MatCn); +} + +#endif // __OPENCV_PERF_UTIL_HPP__ diff --git a/modules/java/generator/gen_java.py b/modules/java/generator/gen_java.py index 433e2eea5..8b39e836e 100755 --- a/modules/java/generator/gen_java.py +++ b/modules/java/generator/gen_java.py @@ -1119,7 +1119,7 @@ extern "C" { ("jdoubleArray _da_retval_ = env->NewDoubleArray(%(cnt)i); " + "jdouble _tmp_retval_[%(cnt)i] = {%(args)s}; " + "env->SetDoubleArrayRegion(_da_retval_, 0, %(cnt)i, _tmp_retval_);") % - { "cnt" : len(fields), "args" : ", ".join(["_retval_" + f[1] for f in fields]) } ) + { "cnt" : len(fields), "args" : ", ".join(["(jdouble)_retval_" + f[1] for f in fields]) } ) if fi.classname and fi.ctype and not fi.static: # non-static class method except c-tor # adding 'self' jn_args.append ( ArgInfo([ "__int64", "nativeObj", "", [], "" ]) ) @@ -1167,7 +1167,7 @@ extern "C" { j_prologue.append( "double[] %s_out = new double[%i];" % (a.name, len(fields)) ) c_epilogue.append( \ "jdouble tmp_%(n)s[%(cnt)i] = {%(args)s}; env->SetDoubleArrayRegion(%(n)s_out, 0, %(cnt)i, tmp_%(n)s);" % - { "n" : a.name, "cnt" : len(fields), "args" : ", ".join([a.name + f[1] for f in fields]) } ) + { "n" : a.name, "cnt" : len(fields), "args" : ", ".join(["(jdouble)" + a.name + f[1] for f in fields]) } ) if a.ctype in ('bool', 'int', 'long', 'float', 'double'): j_epilogue.append('if(%(n)s!=null) %(n)s[0] = (%(t)s)%(n)s_out[0];' % {'n':a.name,'t':a.ctype}) else: diff --git a/modules/java/generator/src/cpp/Mat.cpp b/modules/java/generator/src/cpp/Mat.cpp index fb546ede1..0178f302f 100644 --- a/modules/java/generator/src/cpp/Mat.cpp +++ b/modules/java/generator/src/cpp/Mat.cpp @@ -1069,7 +1069,7 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_locateROI_10 Size wholeSize; Point ofs; me->locateROI( wholeSize, ofs ); - jdouble tmp_wholeSize[2] = {wholeSize.width, wholeSize.height}; env->SetDoubleArrayRegion(wholeSize_out, 0, 2, tmp_wholeSize); jdouble tmp_ofs[2] = {ofs.x, ofs.y}; env->SetDoubleArrayRegion(ofs_out, 0, 2, tmp_ofs); + jdouble tmp_wholeSize[2] = {(jdouble)wholeSize.width, (jdouble)wholeSize.height}; env->SetDoubleArrayRegion(wholeSize_out, 0, 2, tmp_wholeSize); jdouble tmp_ofs[2] = {(jdouble)ofs.x, (jdouble)ofs.y}; env->SetDoubleArrayRegion(ofs_out, 0, 2, tmp_ofs); } catch(const std::exception &e) { throwJavaException(env, &e, method_name); } catch (...) { @@ -1488,7 +1488,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_n_1size Mat* me = (Mat*) self; //TODO: check for NULL Size _retval_ = me->size( ); jdoubleArray _da_retval_ = env->NewDoubleArray(2); - jdouble _tmp_retval_[2] = {_retval_.width, _retval_.height}; + jdouble _tmp_retval_[2] = {(jdouble)_retval_.width, (jdouble)_retval_.height}; env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_); return _da_retval_; } catch(const std::exception &e) { diff --git a/modules/java/generator/src/cpp/gpu.cpp b/modules/java/generator/src/cpp/gpu.cpp index f4b872b92..eebb5483c 100644 --- a/modules/java/generator/src/cpp/gpu.cpp +++ b/modules/java/generator/src/cpp/gpu.cpp @@ -451,9 +451,9 @@ JNIEXPORT void JNICALL Java_org_opencv_gpu_DeviceInfo_queryMemory_10 size_t totalMemory; size_t freeMemory; me->queryMemory( totalMemory, freeMemory ); - jdouble tmp_totalMemory[1] = {totalMemory}; + jdouble tmp_totalMemory[1] = {(jdouble)totalMemory}; env->SetDoubleArrayRegion(totalMemory_out, 0, 1, tmp_totalMemory); - jdouble tmp_freeMemory[1] = {freeMemory}; + jdouble tmp_freeMemory[1] = {(jdouble)freeMemory}; env->SetDoubleArrayRegion(freeMemory_out, 0, 1, tmp_freeMemory); return; } catch(const std::exception &e) { diff --git a/modules/nonfree/src/surf_ocl.cpp b/modules/nonfree/src/surf_ocl.cpp index e6fd6eeb6..add1b56a1 100644 --- a/modules/nonfree/src/surf_ocl.cpp +++ b/modules/nonfree/src/surf_ocl.cpp @@ -119,8 +119,8 @@ public: void compute_descriptors_gpu(const oclMat &descriptors, const oclMat &keypoints, int nFeatures); // end of kernel callers declarations - SURF_OCL_Invoker(SURF_OCL &surf, const oclMat &img, const oclMat &mask) : - surf_(surf), + SURF_OCL_Invoker(SURF_OCL &theSurf, const oclMat &img, const oclMat &mask) : + surf_(theSurf), img_cols(img.cols), img_rows(img.rows), use_mask(!mask.empty()), counters(oclMat()), imgTex(NULL), sumTex(NULL), maskSumTex(NULL), _img(img) @@ -139,7 +139,7 @@ public: CV_Assert(layer_rows - 2 * min_margin > 0); CV_Assert(layer_cols - 2 * min_margin > 0); - maxFeatures = std::min(static_cast(img.size().area() * surf.keypointsRatio), 65535); + maxFeatures = std::min(static_cast(img.size().area() * theSurf.keypointsRatio), 65535); maxCandidates = std::min(static_cast(1.5 * maxFeatures), 65535); CV_Assert(maxFeatures > 0); @@ -396,9 +396,9 @@ void cv::ocl::SURF_OCL::operator()(const oclMat &img, const oclMat &mask, oclMat { if (!img.empty()) { - SURF_OCL_Invoker surf(*this, img, mask); + SURF_OCL_Invoker theSurf(*this, img, mask); - surf.detectKeypoints(keypoints); + theSurf.detectKeypoints(keypoints); } } @@ -407,16 +407,16 @@ void cv::ocl::SURF_OCL::operator()(const oclMat &img, const oclMat &mask, oclMat { if (!img.empty()) { - SURF_OCL_Invoker surf(*this, img, mask); + SURF_OCL_Invoker theSurf(*this, img, mask); if (!useProvidedKeypoints) - surf.detectKeypoints(keypoints); + theSurf.detectKeypoints(keypoints); else if (!upright) { - surf.findOrientation(keypoints); + theSurf.findOrientation(keypoints); } - surf.computeDescriptors(keypoints, descriptors, descriptorSize()); + theSurf.computeDescriptors(keypoints, descriptors, descriptorSize()); } } @@ -482,23 +482,23 @@ void cv::ocl::SURF_OCL::operator()(InputArray img, InputArray mask, vectoruploadKeypoints(keypoints, keypointsGPU); if (!useProvidedKeypoints) - surf.detectKeypoints(keypointsGPU); + theSurf.detectKeypoints(keypointsGPU); else if (!upright) - surf.findOrientation(keypointsGPU); + theSurf.findOrientation(keypointsGPU); if(keypointsGPU.cols*keypointsGPU.rows != 0) ((SURF_OCL*)this)->downloadKeypoints(keypointsGPU, keypoints); if( descriptors.needed() ) { oclMat descriptorsGPU; - surf.computeDescriptors(keypointsGPU, descriptorsGPU, descriptorSize()); + theSurf.computeDescriptors(keypointsGPU, descriptorsGPU, descriptorSize()); Size sz = descriptorsGPU.size(); if( descriptors.kind() == _InputArray::STD_VECTOR ) { diff --git a/modules/ocl/src/arithm.cpp b/modules/ocl/src/arithm.cpp index e7638ecc4..58fa7a607 100644 --- a/modules/ocl/src/arithm.cpp +++ b/modules/ocl/src/arithm.cpp @@ -108,7 +108,7 @@ static void arithmetic_run_generic(const oclMat &src1, const oclMat &src2, const #else size_t localThreads[3] = { 16, 16, 1 }; #endif - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; std::string kernelName = "arithm_binary_op"; @@ -266,7 +266,7 @@ static void compare_run(const oclMat &src1, const oclMat &src2, oclMat &dst, int int depth = src1.depth(); size_t localThreads[3] = { 64, 4, 1 }; - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; int src1step1 = src1.step1(), src1offset1 = src1.offset / src1.elemSize1(); int src2step1 = src2.step1(), src2offset1 = src2.offset / src2.elemSize1(); @@ -336,7 +336,7 @@ static void arithmetic_sum_buffer_run(const oclMat &src, cl_mem &dst, int groupn args.push_back( make_pair( sizeof(cl_int) , (void *)&total )); args.push_back( make_pair( sizeof(cl_int) , (void *)&groupnum )); args.push_back( make_pair( sizeof(cl_mem) , (void *)&dst )); - size_t globalThreads[3] = { groupnum * 256, 1, 1 }; + size_t globalThreads[3] = { (size_t)groupnum * 256, 1, 1 }; #ifdef ANDROID openCLExecuteKernel(src.clCxt, &arithm_sum, "arithm_op_sum", globalThreads, NULL, @@ -514,7 +514,7 @@ static void arithmetic_minMax_run(const oclMat &src, const oclMat & mask, cl_mem buildOptions += " -D WITH_MASK"; } - size_t globalThreads[3] = { groupnum * 256, 1, 1 }; + size_t globalThreads[3] = { (size_t)groupnum * 256, 1, 1 }; size_t localThreads[3] = { 256, 1, 1 }; // kernel use fixed grid size, replace lt on NULL is impossible without kernel changes @@ -638,7 +638,7 @@ static void arithm_absdiff_nonsaturate_run(const oclMat & src1, const oclMat & s #else size_t localThreads[3] = { 16, 16, 1 }; #endif - size_t globalThreads[3] = { diff.cols, diff.rows, 1 }; + size_t globalThreads[3] = { (size_t)diff.cols, (size_t)diff.rows, 1 }; const char * const typeMap[] = { "uchar", "char", "ushort", "short", "int", "float", "double" }; const char * const channelMap[] = { "", "", "2", "4", "4" }; @@ -744,7 +744,7 @@ static void arithmetic_flip_run(const oclMat &src, oclMat &dst, string kernelNam std::string buildOptions = format("-D T=%s%s", typeMap[dst.depth()], channelMap[dst.oclchannels()]); size_t localThreads[3] = { 64, 4, 1 }; - size_t globalThreads[3] = { cols, rows, 1 }; + size_t globalThreads[3] = { (size_t)cols, (size_t)rows, 1 }; int elemSize = src.elemSize(); int src_step = src.step / elemSize, src_offset = src.offset / elemSize; @@ -797,7 +797,7 @@ static void arithmetic_lut_run(const oclMat &src, const oclMat &lut, oclMat &dst int cols1 = src.cols * src.oclchannels(); size_t localSize[] = { 16, 16, 1 }; - size_t globalSize[] = { lut.channels() == 1 ? cols1 : src.cols, src.rows, 1 }; + size_t globalSize[] = { (size_t)(lut.channels() == 1 ? cols1 : src.cols), (size_t)src.rows, 1 }; const char * const typeMap[] = { "uchar", "char", "ushort", "short", "int", "float", "double" }; std::string buildOptions = format("-D srcT=%s -D dstT=%s", typeMap[sdepth], typeMap[dst.depth()]); @@ -862,7 +862,7 @@ static void arithmetic_exp_log_run(const oclMat &src, oclMat &dst, string kernel #else size_t localThreads[3] = { 64, 4, 1 }; #endif - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; std::string buildOptions = format("-D srcT=%s", ddepth == CV_32F ? "float" : "double"); @@ -904,7 +904,7 @@ static void arithmetic_magnitude_phase_run(const oclMat &src1, const oclMat &src #else size_t localThreads[3] = { 64, 4, 1 }; #endif - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; int src1_step = src1.step / src1.elemSize(), src1_offset = src1.offset / src1.elemSize(); int src2_step = src2.step / src2.elemSize(), src2_offset = src2.offset / src2.elemSize(); @@ -956,7 +956,7 @@ static void arithmetic_phase_run(const oclMat &src1, const oclMat &src2, oclMat #else size_t localThreads[3] = { 64, 4, 1 }; #endif - size_t globalThreads[3] = { cols1, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)cols1, (size_t)dst.rows, 1 }; vector > args; args.push_back( make_pair( sizeof(cl_mem), (void *)&src1.data )); @@ -1006,7 +1006,7 @@ static void arithmetic_cartToPolar_run(const oclMat &src1, const oclMat &src2, o #else size_t localThreads[3] = { 64, 4, 1 }; #endif - size_t globalThreads[3] = { cols, src1.rows, 1 }; + size_t globalThreads[3] = { (size_t)cols, (size_t)src1.rows, 1 }; int src1_step = src1.step / src1.elemSize1(), src1_offset = src1.offset / src1.elemSize1(); int src2_step = src2.step / src2.elemSize1(), src2_offset = src2.offset / src2.elemSize1(); @@ -1064,7 +1064,7 @@ static void arithmetic_ptc_run(const oclMat &src1, const oclMat &src2, oclMat &d #else size_t localThreads[3] = { 64, 4, 1 }; #endif - size_t globalThreads[3] = { cols, rows, 1 }; + size_t globalThreads[3] = { (size_t)cols, (size_t)rows, 1 }; int src1_step = src1.step / src1.elemSize1(), src1_offset = src1.offset / src1.elemSize1(); int src2_step = src2.step / src2.elemSize1(), src2_offset = src2.offset / src2.elemSize1(); @@ -1138,7 +1138,7 @@ static void arithmetic_minMaxLoc_run(const oclMat &src, cl_mem &dst, int vlen , args.push_back( make_pair( sizeof(cl_mem) , (void *)&dst )); char build_options[50]; sprintf(build_options, "-D DEPTH_%d -D REPEAT_S%d -D REPEAT_E%d", src.depth(), repeat_s, repeat_e); - size_t gt[3] = {groupnum * 256, 1, 1}, lt[3] = {256, 1, 1}; + size_t gt[3] = {(size_t)groupnum * 256, 1, 1}, lt[3] = {256, 1, 1}; // kernel use fixed grid size, replace lt on NULL is impossible without kernel changes openCLExecuteKernel(src.clCxt, &arithm_minMaxLoc, "arithm_op_minMaxLoc", gt, lt, args, -1, -1, build_options); @@ -1147,7 +1147,7 @@ static void arithmetic_minMaxLoc_run(const oclMat &src, cl_mem &dst, int vlen , static void arithmetic_minMaxLoc_mask_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen, int groupnum) { vector > args; - size_t gt[3] = {groupnum * 256, 1, 1}, lt[3] = {256, 1, 1}; + size_t gt[3] = {(size_t)groupnum * 256, 1, 1}, lt[3] = {256, 1, 1}; char build_options[50]; if (src.oclchannels() == 1) { @@ -1284,7 +1284,7 @@ static void arithmetic_countNonZero_run(const oclMat &src, cl_mem &dst, int grou args.push_back( make_pair( sizeof(cl_int) , (void *)&groupnum )); args.push_back( make_pair( sizeof(cl_mem) , (void *)&dst )); - size_t globalThreads[3] = { groupnum * 256, 1, 1 }; + size_t globalThreads[3] = { (size_t)groupnum * 256, 1, 1 }; #ifdef ANDROID openCLExecuteKernel(src.clCxt, &arithm_nonzero, "arithm_op_nonzero", globalThreads, NULL, @@ -1409,7 +1409,7 @@ static void bitwise_run(const oclMat & src1, const oclMat & src2, const Scalar & args.push_back( make_pair( sizeof(cl_int), (void *)&dst.rows )); args.push_back( make_pair( sizeof(cl_int), (void *)&cols )); - size_t globalsize[3] = { dst.cols * ocn / kercn, dst.rows, 1 }; + size_t globalsize[3] = { (size_t)dst.cols * ocn / kercn, (size_t)dst.rows, 1 }; globalsize[0] = divUp(globalsize[0], 256) * 256; openCLExecuteKernel(src1.clCxt, &arithm_bitwise, "arithm_bitwise", globalsize, NULL, args, -1, -1, buildOptions.c_str()); @@ -1543,7 +1543,7 @@ static void transpose_run(const oclMat &src, oclMat &dst, string kernelName, boo channelsString[src.channels()]); size_t localThreads[3] = { TILE_DIM, BLOCK_ROWS, 1 }; - size_t globalThreads[3] = { src.cols, inplace ? src.rows : divUp(src.rows, TILE_DIM) * BLOCK_ROWS, 1 }; + size_t globalThreads[3] = { (size_t)src.cols, inplace ? (size_t)src.rows : divUp(src.rows, TILE_DIM) * BLOCK_ROWS, 1 }; int srcstep1 = src.step / src.elemSize(), dststep1 = dst.step / dst.elemSize(); int srcoffset1 = src.offset / src.elemSize(), dstoffset1 = dst.offset / dst.elemSize(); @@ -1610,7 +1610,7 @@ void cv::ocl::addWeighted(const oclMat &src1, double alpha, const oclMat &src2, typeMap[depth], hasDouble ? "double" : "float", typeMap[depth], depth >= CV_32F ? "" : "_sat_rte"); - size_t globalThreads[3] = { cols1, dst.rows, 1}; + size_t globalThreads[3] = { (size_t)cols1, (size_t)dst.rows, 1}; float alpha_f = static_cast(alpha), beta_f = static_cast(beta), @@ -1663,7 +1663,7 @@ static void arithmetic_pow_run(const oclMat &src, double p, oclMat &dst, string int depth = dst.depth(); size_t localThreads[3] = { 64, 4, 1 }; - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; const char * const typeStr = depth == CV_32F ? "float" : "double"; const char * const channelMap[] = { "", "", "2", "4", "4" }; @@ -1721,7 +1721,7 @@ void cv::ocl::setIdentity(oclMat& src, const Scalar & scalar) int src_step1 = src.step / src.elemSize(), src_offset1 = src.offset / src.elemSize(); size_t local_threads[] = { 16, 16, 1 }; - size_t global_threads[] = { src.cols, src.rows, 1 }; + size_t global_threads[] = { (size_t)src.cols, (size_t)src.rows, 1 }; const char * const typeMap[] = { "uchar", "char", "ushort", "short", "int", "float", "double" }; const char * const channelMap[] = { "", "", "2", "4", "4" }; diff --git a/modules/ocl/src/bgfg_mog.cpp b/modules/ocl/src/bgfg_mog.cpp index bd25601d0..de9fe8474 100644 --- a/modules/ocl/src/bgfg_mog.cpp +++ b/modules/ocl/src/bgfg_mog.cpp @@ -199,7 +199,7 @@ static void mog_withoutLearning(const oclMat& frame, int cn, oclMat& fgmask, ocl Context* clCxt = Context::getContext(); size_t local_thread[] = {32, 8, 1}; - size_t global_thread[] = {frame.cols, frame.rows, 1}; + size_t global_thread[] = {(size_t)frame.cols, (size_t)frame.rows, 1}; int frame_step = (int)(frame.step/frame.elemSize()); int fgmask_step = (int)(fgmask.step/fgmask.elemSize()); @@ -261,7 +261,7 @@ static void mog_withLearning(const oclMat& frame, int cn, oclMat& fgmask_raw, oc Context* clCxt = Context::getContext(); size_t local_thread[] = {32, 8, 1}; - size_t global_thread[] = {frame.cols, frame.rows, 1}; + size_t global_thread[] = {(size_t)frame.cols, (size_t)frame.rows, 1}; oclMat fgmask(fgmask_raw.size(), CV_32SC1); @@ -342,7 +342,7 @@ void cv::ocl::device::mog::getBackgroundImage_ocl(int cn, const oclMat& weight, Context* clCxt = Context::getContext(); size_t local_thread[] = {32, 8, 1}; - size_t global_thread[] = {dst.cols, dst.rows, 1}; + size_t global_thread[] = {(size_t)dst.cols, (size_t)dst.rows, 1}; int weight_step = (int)(weight.step/weight.elemSize()); int mean_step = (int)(mean.step/mean.elemSize()); @@ -411,7 +411,7 @@ void cv::ocl::device::mog::mog2_ocl(const oclMat& frame, int cn, oclMat& fgmaskR detectShadows_flag = 1; size_t local_thread[] = {32, 8, 1}; - size_t global_thread[] = {frame.cols, frame.rows, 1}; + size_t global_thread[] = {(size_t)frame.cols, (size_t)frame.rows, 1}; int frame_step = (int)(frame.step/frame.elemSize()); int fgmask_step = (int)(fgmask.step/fgmask.elemSize()); @@ -481,7 +481,7 @@ void cv::ocl::device::mog::getBackgroundImage2_ocl(int cn, const oclMat& modesUs Context* clCxt = Context::getContext(); size_t local_thread[] = {32, 8, 1}; - size_t global_thread[] = {modesUsed.cols, modesUsed.rows, 1}; + size_t global_thread[] = {(size_t)modesUsed.cols, (size_t)modesUsed.rows, 1}; int weight_step = (int)(weight.step/weight.elemSize()); int modesUsed_step = (int)(modesUsed.step/modesUsed.elemSize()); diff --git a/modules/ocl/src/blend.cpp b/modules/ocl/src/blend.cpp index a2b70f033..9bf54b15e 100644 --- a/modules/ocl/src/blend.cpp +++ b/modules/ocl/src/blend.cpp @@ -59,7 +59,7 @@ void cv::ocl::blendLinear(const oclMat &src1, const oclMat &src2, const oclMat & dst.create(src1.size(), src1.type()); - size_t globalSize[] = { dst.cols, dst.rows, 1}; + size_t globalSize[] = { (size_t)dst.cols, (size_t)dst.rows, 1}; size_t localSize[] = { 16, 16, 1 }; int depth = dst.depth(), ocn = dst.oclchannels(); diff --git a/modules/ocl/src/brute_force_matcher.cpp b/modules/ocl/src/brute_force_matcher.cpp index b51d4f194..2ed818cb0 100644 --- a/modules/ocl/src/brute_force_matcher.cpp +++ b/modules/ocl/src/brute_force_matcher.cpp @@ -71,7 +71,7 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat const oclMat &trainIdx, const oclMat &distance, int distType) { cv::ocl::Context *ctx = query.clCxt; - size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; + size_t globalSize[] = {((size_t)query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; const size_t smemSize = (BLOCK_SIZE * (MAX_DESC_LEN >= 2 * BLOCK_SIZE ? MAX_DESC_LEN : 2 * BLOCK_SIZE) + BLOCK_SIZE * BLOCK_SIZE) * sizeof(int); int block_size = BLOCK_SIZE; @@ -114,7 +114,7 @@ void match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, int distType) { cv::ocl::Context *ctx = query.clCxt; - size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; + size_t globalSize[] = {((size_t)query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; const size_t smemSize = (2 * BLOCK_SIZE * BLOCK_SIZE) * sizeof(int); int block_size = BLOCK_SIZE; @@ -156,7 +156,7 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDist const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, int distType) { cv::ocl::Context *ctx = query.clCxt; - size_t globalSize[] = {(train.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, (query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, 1}; + size_t globalSize[] = {((size_t)train.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, ((size_t)query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; const size_t smemSize = (2 * BLOCK_SIZE * BLOCK_SIZE) * sizeof(int); int block_size = BLOCK_SIZE; @@ -198,7 +198,7 @@ void radius_match(const oclMat &query, const oclMat &train, float maxDistance, c const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, int distType) { cv::ocl::Context *ctx = query.clCxt; - size_t globalSize[] = {(train.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, (query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, 1}; + size_t globalSize[] = {((size_t)train.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, ((size_t)query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; const size_t smemSize = (2 * BLOCK_SIZE * BLOCK_SIZE) * sizeof(int); int block_size = BLOCK_SIZE; @@ -300,7 +300,7 @@ void knn_matchUnrolledCached(const oclMat &query, const oclMat &train, const ocl const oclMat &trainIdx, const oclMat &distance, int distType) { cv::ocl::Context *ctx = query.clCxt; - size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; + size_t globalSize[] = {((size_t)query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; const size_t smemSize = (BLOCK_SIZE * (MAX_DESC_LEN >= BLOCK_SIZE ? MAX_DESC_LEN : BLOCK_SIZE) + BLOCK_SIZE * BLOCK_SIZE) * sizeof(int); int block_size = BLOCK_SIZE; @@ -337,7 +337,7 @@ void knn_match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, int distType) { cv::ocl::Context *ctx = query.clCxt; - size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; + size_t globalSize[] = {((size_t)query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; const size_t smemSize = (2 * BLOCK_SIZE * BLOCK_SIZE) * sizeof(int); int block_size = BLOCK_SIZE; @@ -372,7 +372,7 @@ template < int BLOCK_SIZE, int MAX_DESC_LEN/*, typename Mask*/ > void calcDistanceUnrolled(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &allDist, int distType) { cv::ocl::Context *ctx = query.clCxt; - size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; + size_t globalSize[] = {((size_t)query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; const size_t smemSize = (2 * BLOCK_SIZE * BLOCK_SIZE) * sizeof(int); int block_size = BLOCK_SIZE; @@ -409,7 +409,7 @@ template < int BLOCK_SIZE/*, typename Mask*/ > void calcDistance(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &allDist, int distType) { cv::ocl::Context *ctx = query.clCxt; - size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; + size_t globalSize[] = {((size_t)query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; size_t localSize[] = {BLOCK_SIZE, BLOCK_SIZE, 1}; const size_t smemSize = (2 * BLOCK_SIZE * BLOCK_SIZE) * sizeof(int); int block_size = BLOCK_SIZE; @@ -481,7 +481,7 @@ template void findKnnMatch(int k, const oclMat &trainIdx, const oclMat &distance, const oclMat &allDist, int /*distType*/) { cv::ocl::Context *ctx = trainIdx.clCxt; - size_t globalSize[] = {trainIdx.rows * BLOCK_SIZE, 1, 1}; + size_t globalSize[] = {(size_t)trainIdx.rows * BLOCK_SIZE, 1, 1}; size_t localSize[] = {BLOCK_SIZE, 1, 1}; int block_size = BLOCK_SIZE; std::string kernelName = "BruteForceMatch_findBestMatch"; @@ -598,14 +598,14 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchConvert(const Mat &trainIdx, cons const float *distance_ptr = distance.ptr(); for (int queryIdx = 0; queryIdx < nQuery; ++queryIdx, ++trainIdx_ptr, ++distance_ptr) { - int trainIdx = *trainIdx_ptr; + int oneTrainIdx = *trainIdx_ptr; - if (trainIdx == -1) + if (oneTrainIdx == -1) continue; - float distance = *distance_ptr; + float oneDistance = *distance_ptr; - DMatch m(queryIdx, trainIdx, 0, distance); + DMatch m(queryIdx, oneTrainIdx, 0, oneDistance); matches.push_back(m); } @@ -713,16 +713,16 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchConvert(const Mat &trainIdx, cons const float *distance_ptr = distance.ptr(); for (int queryIdx = 0; queryIdx < nQuery; ++queryIdx, ++trainIdx_ptr, ++imgIdx_ptr, ++distance_ptr) { - int trainIdx = *trainIdx_ptr; + int oneTrainIdx = *trainIdx_ptr; - if (trainIdx == -1) + if (oneTrainIdx == -1) continue; - int imgIdx = *imgIdx_ptr; + int oneImgIdx = *imgIdx_ptr; - float distance = *distance_ptr; + float oneDistance = *distance_ptr; - DMatch m(queryIdx, trainIdx, imgIdx, distance); + DMatch m(queryIdx, oneTrainIdx, oneImgIdx, oneDistance); matches.push_back(m); } @@ -811,13 +811,13 @@ void cv::ocl::BruteForceMatcher_OCL_base::knnMatchConvert(const Mat &trainIdx, c for (int i = 0; i < k; ++i, ++trainIdx_ptr, ++distance_ptr) { - int trainIdx = *trainIdx_ptr; + int oneTrainIdx = *trainIdx_ptr; - if (trainIdx != -1) + if (oneTrainIdx != -1) { - float distance = *distance_ptr; + float oneDistance = *distance_ptr; - DMatch m(queryIdx, trainIdx, 0, distance); + DMatch m(queryIdx, oneTrainIdx, 0, oneDistance); curMatches.push_back(m); } @@ -901,15 +901,15 @@ void cv::ocl::BruteForceMatcher_OCL_base::knnMatch2Convert(const Mat &trainIdx, for (int i = 0; i < 2; ++i, ++trainIdx_ptr, ++imgIdx_ptr, ++distance_ptr) { - int trainIdx = *trainIdx_ptr; + int oneTrainIdx = *trainIdx_ptr; - if (trainIdx != -1) + if (oneTrainIdx != -1) { - int imgIdx = *imgIdx_ptr; + int oneImgIdx = *imgIdx_ptr; - float distance = *distance_ptr; + float oneDistance = *distance_ptr; - DMatch m(queryIdx, trainIdx, imgIdx, distance); + DMatch m(queryIdx, oneTrainIdx, oneImgIdx, oneDistance); curMatches.push_back(m); } @@ -1051,25 +1051,25 @@ void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchConvert(const Mat &trainIdx const int *trainIdx_ptr = trainIdx.ptr(queryIdx); const float *distance_ptr = distance.ptr(queryIdx); - const int nMatches = std::min(nMatches_ptr[queryIdx], trainIdx.cols); + const int matchesNum = std::min(nMatches_ptr[queryIdx], trainIdx.cols); - if (nMatches == 0) + if (matchesNum == 0) { if (!compactResult) matches.push_back(vector()); continue; } - matches.push_back(vector(nMatches)); + matches.push_back(vector(matchesNum)); vector &curMatches = matches.back(); - for (int i = 0; i < nMatches; ++i, ++trainIdx_ptr, ++distance_ptr) + for (int i = 0; i < matchesNum; ++i, ++trainIdx_ptr, ++distance_ptr) { - int trainIdx = *trainIdx_ptr; + int oneTrainIdx = *trainIdx_ptr; - float distance = *distance_ptr; + float oneDistance = *distance_ptr; - DMatch m(queryIdx, trainIdx, 0, distance); + DMatch m(queryIdx, oneTrainIdx, 0, oneDistance); curMatches[i] = m; } @@ -1177,9 +1177,9 @@ void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchConvert(const Mat &trainIdx const int *imgIdx_ptr = imgIdx.ptr(queryIdx); const float *distance_ptr = distance.ptr(queryIdx); - const int nMatches = std::min(nMatches_ptr[queryIdx], trainIdx.cols); + const int matchesNum = std::min(nMatches_ptr[queryIdx], trainIdx.cols); - if (nMatches == 0) + if (matchesNum == 0) { if (!compactResult) matches.push_back(vector()); @@ -1188,15 +1188,15 @@ void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchConvert(const Mat &trainIdx matches.push_back(vector()); vector &curMatches = matches.back(); - curMatches.reserve(nMatches); + curMatches.reserve(matchesNum); - for (int i = 0; i < nMatches; ++i, ++trainIdx_ptr, ++imgIdx_ptr, ++distance_ptr) + for (int i = 0; i < matchesNum; ++i, ++trainIdx_ptr, ++imgIdx_ptr, ++distance_ptr) { - int trainIdx = *trainIdx_ptr; - int imgIdx = *imgIdx_ptr; - float distance = *distance_ptr; + int oneTrainIdx = *trainIdx_ptr; + int oneImgIdx = *imgIdx_ptr; + float oneDistance = *distance_ptr; - DMatch m(queryIdx, trainIdx, imgIdx, distance); + DMatch m(queryIdx, oneTrainIdx, oneImgIdx, oneDistance); curMatches.push_back(m); } diff --git a/modules/ocl/src/build_warps.cpp b/modules/ocl/src/build_warps.cpp index 57c7bc96e..13cfd966d 100644 --- a/modules/ocl/src/build_warps.cpp +++ b/modules/ocl/src/build_warps.cpp @@ -91,7 +91,7 @@ void cv::ocl::buildWarpPlaneMaps(Size /*src_size*/, Rect dst_roi, const Mat &K, args.push_back( make_pair( sizeof(cl_int), (void *)&ymap_offset)); args.push_back( make_pair( sizeof(cl_float), (void *)&scale)); - size_t globalThreads[3] = { xmap.cols, xmap.rows, 1 }; + size_t globalThreads[3] = { (size_t)xmap.cols, (size_t)xmap.rows, 1 }; #ifdef ANDROID size_t localThreads[3] = {32, 4, 1}; #else @@ -137,7 +137,7 @@ void cv::ocl::buildWarpCylindricalMaps(Size /*src_size*/, Rect dst_roi, const Ma args.push_back( make_pair( sizeof(cl_int), (void *)&ymap_offset)); args.push_back( make_pair( sizeof(cl_float), (void *)&scale)); - size_t globalThreads[3] = { xmap.cols, xmap.rows, 1 }; + size_t globalThreads[3] = { (size_t)xmap.cols, (size_t)xmap.rows, 1 }; #ifdef ANDROID size_t localThreads[3] = {32, 1, 1}; #else @@ -183,7 +183,7 @@ void cv::ocl::buildWarpSphericalMaps(Size /*src_size*/, Rect dst_roi, const Mat args.push_back( make_pair( sizeof(cl_int), (void *)&ymap_offset)); args.push_back( make_pair( sizeof(cl_float), (void *)&scale)); - size_t globalThreads[3] = { xmap.cols, xmap.rows, 1 }; + size_t globalThreads[3] = { (size_t)xmap.cols, (size_t)xmap.rows, 1 }; #ifdef ANDROID size_t localThreads[3] = {32, 4, 1}; #else @@ -231,7 +231,7 @@ void cv::ocl::buildWarpAffineMaps(const Mat &M, bool inverse, Size dsize, oclMat args.push_back( make_pair( sizeof(cl_int), (void *)&xmap_offset)); args.push_back( make_pair( sizeof(cl_int), (void *)&ymap_offset)); - size_t globalThreads[3] = { xmap.cols, xmap.rows, 1 }; + size_t globalThreads[3] = { (size_t)xmap.cols, (size_t)xmap.rows, 1 }; #ifdef ANDROID size_t localThreads[3] = {32, 4, 1}; #else @@ -279,7 +279,7 @@ void cv::ocl::buildWarpPerspectiveMaps(const Mat &M, bool inverse, Size dsize, o args.push_back( make_pair( sizeof(cl_int), (void *)&xmap_offset)); args.push_back( make_pair( sizeof(cl_int), (void *)&ymap_offset)); - size_t globalThreads[3] = { xmap.cols, xmap.rows, 1 }; + size_t globalThreads[3] = { (size_t)xmap.cols, (size_t)xmap.rows, 1 }; openCLExecuteKernel(Context::getContext(), &build_warps, "buildWarpPerspectiveMaps", globalThreads, NULL, args, -1, -1); } diff --git a/modules/ocl/src/canny.cpp b/modules/ocl/src/canny.cpp index e0d788bc0..05d15eb6a 100644 --- a/modules/ocl/src/canny.cpp +++ b/modules/ocl/src/canny.cpp @@ -221,7 +221,7 @@ void canny::calcSobelRowPass_gpu(const oclMat &src, oclMat &dx_buf, oclMat &dy_b args.push_back( make_pair( sizeof(cl_int), (void *)&dy_buf.step)); args.push_back( make_pair( sizeof(cl_int), (void *)&dy_buf.offset)); - size_t globalThreads[3] = {cols, rows, 1}; + size_t globalThreads[3] = {(size_t)cols, (size_t)rows, 1}; size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &imgproc_canny, kernelName, globalThreads, localThreads, args, -1, -1); } @@ -250,7 +250,7 @@ void canny::calcMagnitude_gpu(const oclMat &dx_buf, const oclMat &dy_buf, oclMat args.push_back( make_pair( sizeof(cl_int), (void *)&mag.step)); args.push_back( make_pair( sizeof(cl_int), (void *)&mag.offset)); - size_t globalThreads[3] = {cols, rows, 1}; + size_t globalThreads[3] = {(size_t)cols, (size_t)rows, 1}; size_t localThreads[3] = {16, 16, 1}; const char * build_options = L2Grad ? "-D L2GRAD":""; @@ -274,7 +274,7 @@ void canny::calcMagnitude_gpu(const oclMat &dx, const oclMat &dy, oclMat &mag, i args.push_back( make_pair( sizeof(cl_int), (void *)&mag.step)); args.push_back( make_pair( sizeof(cl_int), (void *)&mag.offset)); - size_t globalThreads[3] = {cols, rows, 1}; + size_t globalThreads[3] = {(size_t)cols, (size_t)rows, 1}; size_t localThreads[3] = {16, 16, 1}; const char * build_options = L2Grad ? "-D L2GRAD":""; @@ -305,7 +305,7 @@ void canny::calcMap_gpu(oclMat &dx, oclMat &dy, oclMat &mag, oclMat &map, int ro args.push_back( make_pair( sizeof(cl_int), (void *)&map.offset)); - size_t globalThreads[3] = {cols, rows, 1}; + size_t globalThreads[3] = {(size_t)cols, (size_t)rows, 1}; string kernelName = "calcMap"; size_t localThreads[3] = {16, 16, 1}; @@ -331,7 +331,7 @@ void canny::edgesHysteresisLocal_gpu(oclMat &map, oclMat &st1, oclMat& counter, cl_int offsetBytes = map.offset; args.push_back( make_pair( sizeof(cl_int), (void *)&offsetBytes)); - size_t globalThreads[3] = {cols, rows, 1}; + size_t globalThreads[3] = {(size_t)cols, (size_t)rows, 1}; size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &imgproc_canny, "edgesHysteresisLocal", globalThreads, localThreads, args, -1, -1); @@ -355,7 +355,7 @@ void canny::edgesHysteresisGlobal_gpu(oclMat &map, oclMat &st1, oclMat &st2, ocl counter.upload(counterMat); args.clear(); - size_t globalThreads[3] = {std::min((unsigned)count, 65535u) * 128, divUp(count, 65535), 1}; + size_t globalThreads[3] = {(size_t)std::min((unsigned)count, 65535u) * 128, divUp(count, 65535), 1}; args.push_back( make_pair( sizeof(cl_mem), (void *)&map.data)); args.push_back( make_pair( sizeof(cl_mem), (void *)&st1.data)); args.push_back( make_pair( sizeof(cl_mem), (void *)&st2.data)); @@ -386,7 +386,7 @@ void canny::getEdges_gpu(oclMat &map, oclMat &dst, int rows, int cols) args.push_back( make_pair( sizeof(cl_int), (void *)&dst.step)); args.push_back( make_pair( sizeof(cl_int), (void *)&dst.offset)); - size_t globalThreads[3] = {cols, rows, 1}; + size_t globalThreads[3] = {(size_t)cols, (size_t)rows, 1}; size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &imgproc_canny, kernelName, globalThreads, localThreads, args, -1, -1); diff --git a/modules/ocl/src/cl_context.cpp b/modules/ocl/src/cl_context.cpp index 4a757c8ae..f0df45202 100644 --- a/modules/ocl/src/cl_context.cpp +++ b/modules/ocl/src/cl_context.cpp @@ -167,28 +167,28 @@ struct DeviceInfoImpl: public DeviceInfo parseOpenCLVersion(this->deviceVersion, this->deviceVersionMajor, this->deviceVersionMinor); - size_t maxWorkGroupSize = 0; - openCLSafeCall(getScalarInfo(clGetDeviceInfo, device, CL_DEVICE_MAX_WORK_GROUP_SIZE, maxWorkGroupSize)); - this->maxWorkGroupSize = maxWorkGroupSize; + size_t maxWGS = 0; + openCLSafeCall(getScalarInfo(clGetDeviceInfo, device, CL_DEVICE_MAX_WORK_GROUP_SIZE, maxWGS)); + this->maxWorkGroupSize = maxWGS; cl_uint maxDimensions = 0; openCLSafeCall(getScalarInfo(clGetDeviceInfo, device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, maxDimensions)); - std::vector maxWorkItemSizes(maxDimensions); + std::vector maxWIS(maxDimensions); openCLSafeCall(clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(size_t) * maxDimensions, - (void *)&maxWorkItemSizes[0], 0)); - this->maxWorkItemSizes = maxWorkItemSizes; + (void *)&maxWIS[0], 0)); + this->maxWorkItemSizes = maxWIS; - cl_uint maxComputeUnits = 0; - openCLSafeCall(getScalarInfo(clGetDeviceInfo, device, CL_DEVICE_MAX_COMPUTE_UNITS, maxComputeUnits)); - this->maxComputeUnits = maxComputeUnits; + cl_uint maxCU = 0; + openCLSafeCall(getScalarInfo(clGetDeviceInfo, device, CL_DEVICE_MAX_COMPUTE_UNITS, maxCU)); + this->maxComputeUnits = maxCU; - cl_ulong localMemorySize = 0; - openCLSafeCall(getScalarInfo(clGetDeviceInfo, device, CL_DEVICE_LOCAL_MEM_SIZE, localMemorySize)); - this->localMemorySize = (size_t)localMemorySize; + cl_ulong localMS = 0; + openCLSafeCall(getScalarInfo(clGetDeviceInfo, device, CL_DEVICE_LOCAL_MEM_SIZE, localMS)); + this->localMemorySize = (size_t)localMS; - cl_ulong maxMemAllocSize = 0; - openCLSafeCall(getScalarInfo(clGetDeviceInfo, device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, maxMemAllocSize)); - this->maxMemAllocSize = (size_t)maxMemAllocSize; + cl_ulong maxMAS = 0; + openCLSafeCall(getScalarInfo(clGetDeviceInfo, device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, maxMAS)); + this->maxMemAllocSize = (size_t)maxMAS; cl_bool unifiedMemory = false; openCLSafeCall(getScalarInfo(clGetDeviceInfo, device, CL_DEVICE_HOST_UNIFIED_MEMORY, unifiedMemory)); diff --git a/modules/ocl/src/cl_programcache.cpp b/modules/ocl/src/cl_programcache.cpp index 483329922..7af6d4e50 100644 --- a/modules/ocl/src/cl_programcache.cpp +++ b/modules/ocl/src/cl_programcache.cpp @@ -397,16 +397,16 @@ struct ProgramFileCache sizeof(size_t), &binarySize, NULL)); - std::vector binary(binarySize); + std::vector localBinary(binarySize); - char* ptr = &binary[0]; + char* ptr = &localBinary[0]; openCLSafeCall(clGetProgramInfo(program, CL_PROGRAM_BINARIES, sizeof(char*), &ptr, NULL)); - if (!writeConfigurationToFile(options, binary)) + if (!writeConfigurationToFile(options, localBinary)) { std::cerr << "Can't write data to file: " << fileName_ << std::endl; } @@ -463,7 +463,7 @@ cl_program ProgramCache::getProgram(const Context *ctx, const cv::ocl::ProgramEn } { - cv::AutoLock lockCache(mutexCache); + cv::AutoLock localLockCache(mutexCache); cl_program program = ProgramCache::getProgramCache()->progLookup(src_sign.str()); if (!!program) { @@ -478,7 +478,7 @@ cl_program ProgramCache::getProgram(const Context *ctx, const cv::ocl::ProgramEn // second check if (source->name) { - cv::AutoLock lockCache(mutexCache); + cv::AutoLock localLockCache(mutexCache); cl_program program = ProgramCache::getProgramCache()->progLookup(src_sign.str()); if (!!program) { @@ -504,7 +504,7 @@ cl_program ProgramCache::getProgram(const Context *ctx, const cv::ocl::ProgramEn //Cache the binary for future use if build_options is null if (source->name) { - cv::AutoLock lockCache(mutexCache); + cv::AutoLock localLockCache(mutexCache); this->addProgram(src_sign.str(), program); } return program; diff --git a/modules/ocl/src/cl_runtime/cl_runtime.cpp b/modules/ocl/src/cl_runtime/cl_runtime.cpp index c3a31ccc3..c7a0e126f 100644 --- a/modules/ocl/src/cl_runtime/cl_runtime.cpp +++ b/modules/ocl/src/cl_runtime/cl_runtime.cpp @@ -31,11 +31,11 @@ opencl_module = GetModuleHandleA("OpenCL.dll"); if (!opencl_module) { - const char* name = "OpenCL.dll"; + const char* libName = "OpenCL.dll"; const char* envOpenCLBinary = getenv("OPENCV_OPENCL_BINARY"); if (envOpenCLBinary) - name = envOpenCLBinary; - opencl_module = LoadLibraryA(name); + libName = envOpenCLBinary; + opencl_module = LoadLibraryA(libName); if (!opencl_module) return NULL; } diff --git a/modules/ocl/src/color.cpp b/modules/ocl/src/color.cpp index e323934b4..8e928f7f0 100644 --- a/modules/ocl/src/color.cpp +++ b/modules/ocl/src/color.cpp @@ -87,7 +87,7 @@ static void fromRGB_caller(const oclMat &src, oclMat &dst, int bidx, const std:: if (!data2.empty()) args.push_back( make_pair( sizeof(cl_mem) , (void *)&data2.data )); - size_t gt[3] = { dst.cols/pixels_per_work_item, dst.rows, 1 }; + size_t gt[3] = { (size_t)dst.cols/pixels_per_work_item, (size_t)dst.rows, 1 }; #ifdef ANDROID size_t lt[3] = { 16, 10, 1 }; #else @@ -122,7 +122,7 @@ static void toHSV_caller(const oclMat &src, oclMat &dst, int bidx, const std::st if (!data2.empty()) args.push_back( make_pair( sizeof(cl_mem) , (void *)&data2.data )); - size_t gt[3] = { dst.cols, dst.rows, 1 }; + size_t gt[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; #ifdef ANDROID size_t lt[3] = { 16, 10, 1 }; #else @@ -154,7 +154,7 @@ static void fromGray_caller(const oclMat &src, oclMat &dst, int bidx, const std: if (!data.empty()) args.push_back( make_pair( sizeof(cl_mem) , (void *)&data.data )); - size_t gt[3] = { dst.cols, dst.rows, 1 }; + size_t gt[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; #ifdef ANDROID size_t lt[3] = { 16, 10, 1 }; #else @@ -197,7 +197,7 @@ static void toRGB_caller(const oclMat &src, oclMat &dst, int bidx, const std::st if (!data.empty()) args.push_back( make_pair( sizeof(cl_mem) , (void *)&data.data )); - size_t gt[3] = { dst.cols/pixels_per_work_item, dst.rows, 1 }; + size_t gt[3] = { (size_t)dst.cols/pixels_per_work_item, (size_t)dst.rows, 1 }; #ifdef ANDROID size_t lt[3] = { 16, 10, 1 }; #else @@ -229,7 +229,7 @@ static void toRGB_NV12_caller(const oclMat &src, oclMat &dst, int bidx, const st if (!data.empty()) args.push_back( make_pair( sizeof(cl_mem) , (void *)&data.data )); - size_t gt[3] = {src.cols, src.rows, 1}; + size_t gt[3] = {(size_t)src.cols, (size_t)src.rows, 1}; #ifdef ANDROID size_t lt[3] = {16, 10, 1}; #else @@ -261,7 +261,7 @@ static void fromHSV_caller(const oclMat &src, oclMat &dst, int bidx, const std:: if (!data.empty()) args.push_back( make_pair( sizeof(cl_mem) , (void *)&data.data )); - size_t gt[3] = { dst.cols, dst.rows, 1 }; + size_t gt[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; #ifdef ANDROID size_t lt[3] = { 16, 10, 1 }; #else @@ -288,7 +288,7 @@ static void RGB_caller(const oclMat &src, oclMat &dst, bool reverse) args.push_back( make_pair( sizeof(cl_int) , (void *)&src_offset )); args.push_back( make_pair( sizeof(cl_int) , (void *)&dst_offset )); - size_t gt[3] = { dst.cols, dst.rows, 1 }; + size_t gt[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; #ifdef ANDROID size_t lt[3] = { 16, 10, 1 }; #else @@ -314,7 +314,7 @@ static void fromRGB5x5_caller(const oclMat &src, oclMat &dst, int bidx, int gree args.push_back( make_pair( sizeof(cl_int) , (void *)&src_offset )); args.push_back( make_pair( sizeof(cl_int) , (void *)&dst_offset )); - size_t gt[3] = { dst.cols, dst.rows, 1 }; + size_t gt[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; #ifdef ANDROID size_t lt[3] = { 16, 10, 1 }; #else @@ -340,7 +340,7 @@ static void toRGB5x5_caller(const oclMat &src, oclMat &dst, int bidx, int greenb args.push_back( make_pair( sizeof(cl_int) , (void *)&src_offset )); args.push_back( make_pair( sizeof(cl_int) , (void *)&dst_offset )); - size_t gt[3] = { dst.cols, dst.rows, 1 }; + size_t gt[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; #ifdef ANDROID size_t lt[3] = { 16, 10, 1 }; #else diff --git a/modules/ocl/src/columnsum.cpp b/modules/ocl/src/columnsum.cpp index 67d5d3374..baa6427d8 100644 --- a/modules/ocl/src/columnsum.cpp +++ b/modules/ocl/src/columnsum.cpp @@ -67,7 +67,7 @@ void cv::ocl::columnSum(const oclMat &src, oclMat &dst) args.push_back( make_pair( sizeof(cl_int), (void *)&src_offset)); args.push_back( make_pair( sizeof(cl_int), (void *)&dst_offset)); - size_t globalThreads[3] = {dst.cols, 1, 1}; + size_t globalThreads[3] = {(size_t)dst.cols, 1, 1}; size_t localThreads[3] = {256, 1, 1}; openCLExecuteKernel(src.clCxt, &imgproc_columnsum, "columnSum", globalThreads, localThreads, args, src.oclchannels(), src.depth()); diff --git a/modules/ocl/src/filtering.cpp b/modules/ocl/src/filtering.cpp index 77052ffbf..34f5a5e7b 100644 --- a/modules/ocl/src/filtering.cpp +++ b/modules/ocl/src/filtering.cpp @@ -690,20 +690,20 @@ static void GPUFilter2D(const oclMat &src, oclMat &dst, const Mat &kernel, size_t lt[3] = {BLOCK_SIZE, 1, 1}; size_t gt[3] = {divUp(dst.cols, BLOCK_SIZE - (ksize.width - 1)) * BLOCK_SIZE, divUp(dst.rows, BLOCK_SIZE_Y), 1}; - cl_kernel kernel = openCLGetKernelFromSource(src.clCxt, &filtering_filter2D, "filter2D", -1, -1, build_options); + cl_kernel localKernel = openCLGetKernelFromSource(src.clCxt, &filtering_filter2D, "filter2D", -1, -1, build_options); size_t kernelWorkGroupSize; - openCLSafeCall(clGetKernelWorkGroupInfo(kernel, getClDeviceID(src.clCxt), + openCLSafeCall(clGetKernelWorkGroupInfo(localKernel, getClDeviceID(src.clCxt), CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &kernelWorkGroupSize, 0)); if (lt[0] > kernelWorkGroupSize) { - clReleaseKernel(kernel); + clReleaseKernel(localKernel); CV_Assert(BLOCK_SIZE > kernelWorkGroupSize); tryWorkItems = kernelWorkGroupSize; continue; } - openCLExecuteKernel(src.clCxt, kernel, gt, lt, args); // kernel will be released here + openCLExecuteKernel(src.clCxt, localKernel, gt, lt, args); // kernel will be released here } while (false); } @@ -1170,7 +1170,7 @@ void linearRowFilter_gpu(const oclMat &src, const oclMat &dst, oclMat mat_kernel #else size_t localThreads[3] = { 16, 16, 1 }; #endif - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; const char * const borderMap[] = { "BORDER_CONSTANT", "BORDER_REPLICATE", "BORDER_REFLECT", "BORDER_WRAP", "BORDER_REFLECT_101" }; std::string buildOptions = format("-D RADIUSX=%d -D LSIZE0=%d -D LSIZE1=%d -D CN=%d -D %s", diff --git a/modules/ocl/src/gftt.cpp b/modules/ocl/src/gftt.cpp index 4f204d6f4..e5f405fc0 100644 --- a/modules/ocl/src/gftt.cpp +++ b/modules/ocl/src/gftt.cpp @@ -75,8 +75,8 @@ static void sortCorners_caller(oclMat& corners, const int count) Context * cxt = Context::getContext(); int GS = count/2; int LS = min(255,GS); - size_t globalThreads[3] = {GS, 1, 1}; - size_t localThreads[3] = {LS, 1, 1}; + size_t globalThreads[3] = {(size_t)GS, 1, 1}; + size_t localThreads[3] = {(size_t)LS, 1, 1}; // 2^numStages should be equal to count or the output is invalid int numStages = 0; @@ -130,7 +130,7 @@ static void findCorners_caller( args.push_back(make_pair( sizeof(cl_int), (void*)&corners.cols )); args.push_back(make_pair( sizeof(cl_mem), (void*)&counter.data )); - size_t globalThreads[3] = {eig_mat.cols, eig_mat.rows, 1}; + size_t globalThreads[3] = {(size_t)eig_mat.cols, (size_t)eig_mat.rows, 1}; size_t localThreads[3] = {16, 16, 1}; if(!mask.empty()) opt += " -D WITH_MASK=1"; @@ -164,7 +164,7 @@ static void minMaxEig_caller(const oclMat &src, oclMat &dst, oclMat & tozero) args.push_back( make_pair( sizeof(cl_int) , (void *)&total)); args.push_back( make_pair( sizeof(cl_int) , (void *)&groupnum)); args.push_back( make_pair( sizeof(cl_mem) , (void *)&dst_data )); - size_t globalThreads[3] = {groupnum * 256, 1, 1}; + size_t globalThreads[3] = {(size_t)groupnum * 256, 1, 1}; size_t localThreads[3] = {256, 1, 1}; openCLExecuteKernel(src.clCxt, &arithm_minMax, "arithm_op_minMax", globalThreads, localThreads, args, -1, -1, "-D T=float -D DEPTH_5 -D vlen=1"); diff --git a/modules/ocl/src/haar.cpp b/modules/ocl/src/haar.cpp index 17835f236..5cf641d72 100644 --- a/modules/ocl/src/haar.cpp +++ b/modules/ocl/src/haar.cpp @@ -902,9 +902,9 @@ CvSeq *cv::ocl::OclCascadeClassifier::oclHaarDetectObjects( oclMat &gimg, CvMemS // pack node info to have less memory loads on the device side oclMat oclNodesPK(1,sizeof(cl_int) * NODE_SIZE * nodenum,CV_8U); { - cl_int status; - cl_int* pNodesPK = (cl_int*)clEnqueueMapBuffer(getClCommandQueue(oclNodesPK.clCxt),(cl_mem)oclNodesPK.datastart,true,CL_MAP_WRITE, 0, oclNodesPK.step, 0,0,0,&status); - openCLVerifyCall(status); + cl_int localStatus; + cl_int* pNodesPK = (cl_int*)clEnqueueMapBuffer(getClCommandQueue(oclNodesPK.clCxt),(cl_mem)oclNodesPK.datastart,true,CL_MAP_WRITE, 0, oclNodesPK.step, 0,0,0,&localStatus); + openCLVerifyCall(localStatus); //use known local data stride to precalulate indexes int DATA_SIZE_X = (localThreads[0]+cascade->orig_window_size.width); // check that maximal value is less than maximal unsigned short @@ -921,11 +921,11 @@ CvSeq *cv::ocl::OclCascadeClassifier::oclHaarDetectObjects( oclMat &gimg, CvMemS struct NodePK * pOut = (struct NodePK *)(pNodesPK + NODE_SIZE*i); for(int k=0;k<3;++k) {// calc 4 short indexes in shared local mem for each rectangle instead of 2 (x,y) pair. - int* p = &(node[i].p[k][0]); - pOut->slm_index[k][0] = (unsigned short)(p[1]*DATA_SIZE_X+p[0]); - pOut->slm_index[k][1] = (unsigned short)(p[1]*DATA_SIZE_X+p[2]); - pOut->slm_index[k][2] = (unsigned short)(p[3]*DATA_SIZE_X+p[0]); - pOut->slm_index[k][3] = (unsigned short)(p[3]*DATA_SIZE_X+p[2]); + int* lp = &(node[i].p[k][0]); + pOut->slm_index[k][0] = (unsigned short)(lp[1]*DATA_SIZE_X+lp[0]); + pOut->slm_index[k][1] = (unsigned short)(lp[1]*DATA_SIZE_X+lp[2]); + pOut->slm_index[k][2] = (unsigned short)(lp[3]*DATA_SIZE_X+lp[0]); + pOut->slm_index[k][3] = (unsigned short)(lp[3]*DATA_SIZE_X+lp[2]); } //store used float point values for each node pOut->weight[0] = node[i].weight[0]; @@ -959,13 +959,13 @@ CvSeq *cv::ocl::OclCascadeClassifier::oclHaarDetectObjects( oclMat &gimg, CvMemS if(WGNumTotal>WGNumSampled) {// small images and each pixel is processed // setup global sizes to have linear array of workgroups with WGNum size - int pixelstep = 1; - size_t LS[3]={localThreads[0]/pixelstep,localThreads[1]/pixelstep,1}; + int pstep = 1; + size_t LS[3]={localThreads[0]/pstep,localThreads[1]/pstep,1}; globalThreads[0] = LS[0]*(WGNumTotal-WGNumSampled); globalThreads[1] = LS[1]; globalThreads[2] = 1; string options1 = options; - options1 += format(" -D PIXEL_STEP=%d",pixelstep); + options1 += format(" -D PIXEL_STEP=%d",pstep); options1 += format(" -D WGSTART=%d",WGNumSampled); options1 += format(" -D LSx=%d",LS[0]); options1 += format(" -D LSy=%d",LS[1]); @@ -975,13 +975,13 @@ CvSeq *cv::ocl::OclCascadeClassifier::oclHaarDetectObjects( oclMat &gimg, CvMemS if(WGNumSampled>0) {// large images each 4th pixel is processed // setup global sizes to have linear array of workgroups with WGNum size - int pixelstep = 2; - size_t LS[3]={localThreads[0]/pixelstep,localThreads[1]/pixelstep,1}; + int pstep = 2; + size_t LS[3]={localThreads[0]/pstep,localThreads[1]/pstep,1}; globalThreads[0] = LS[0]*WGNumSampled; globalThreads[1] = LS[1]; globalThreads[2] = 1; string options2 = options; - options2 += format(" -D PIXEL_STEP=%d",pixelstep); + options2 += format(" -D PIXEL_STEP=%d",pstep); options2 += format(" -D WGSTART=%d",0); options2 += format(" -D LSx=%d",LS[0]); options2 += format(" -D LSy=%d",LS[1]); @@ -1117,7 +1117,7 @@ CvSeq *cv::ocl::OclCascadeClassifier::oclHaarDetectObjects( oclMat &gimg, CvMemS args1.push_back ( make_pair(sizeof(cl_float) , (void *)&correction[i] )); args1.push_back ( make_pair(sizeof(cl_int) , (void *)&startnodenum )); - size_t globalThreads2[3] = {nodenum, 1, 1}; + size_t globalThreads2[3] = {(size_t)nodenum, 1, 1}; openCLExecuteKernel(gsum.clCxt, &haarobjectdetect_scaled2, "gpuscaleclassifier", globalThreads2, NULL/*localThreads2*/, args1, -1, -1); } @@ -1255,7 +1255,7 @@ void cv::ocl::OclCascadeClassifierBuf::detectMultiScale(oclMat &gimg, CV_OUT std { int blocksize = 8; int grp_per_CU = 12; - size_t localThreads[3] = { blocksize, blocksize, 1 }; + size_t localThreads[3] = { (size_t)blocksize, (size_t)blocksize, 1 }; size_t globalThreads[3] = { grp_per_CU * cv::ocl::Context::getContext()->getDeviceInfo().maxComputeUnits *localThreads[0], localThreads[1], 1 }; @@ -1531,7 +1531,7 @@ void cv::ocl::OclCascadeClassifierBuf::Init(const int rows, const int cols, args1.push_back ( make_pair(sizeof(cl_float) , (void *)&correction[i] )); args1.push_back ( make_pair(sizeof(cl_int) , (void *)&startnodenum )); - size_t globalThreads2[3] = {m_nodenum, 1, 1}; + size_t globalThreads2[3] = {(size_t)m_nodenum, 1, 1}; openCLExecuteKernel(Context::getContext(), &haarobjectdetect_scaled2, "gpuscaleclassifier", globalThreads2, NULL/*localThreads2*/, args1, -1, -1); } diff --git a/modules/ocl/src/hog.cpp b/modules/ocl/src/hog.cpp index 5c67d2b26..4ac621d68 100644 --- a/modules/ocl/src/hog.cpp +++ b/modules/ocl/src/hog.cpp @@ -242,7 +242,7 @@ void cv::ocl::HOGDescriptor::init_buffer(const oclMat &img, Size win_stride) gauss_w_lut.upload(gaussian_lut); } -void cv::ocl::HOGDescriptor::computeGradient(const oclMat &img, oclMat &grad, oclMat &qangle) +void cv::ocl::HOGDescriptor::computeGradient(const oclMat &img, oclMat &lgrad, oclMat &lqangle) { CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4); @@ -251,11 +251,11 @@ void cv::ocl::HOGDescriptor::computeGradient(const oclMat &img, oclMat &grad, oc { case CV_8UC1: hog::compute_gradients_8UC1(effect_size.height, effect_size.width, img, - angleScale, grad, qangle, gamma_correction); + angleScale, lgrad, lqangle, gamma_correction); break; case CV_8UC4: hog::compute_gradients_8UC4(effect_size.height, effect_size.width, img, - angleScale, grad, qangle, gamma_correction); + angleScale, lgrad, lqangle, gamma_correction); break; } } @@ -1646,7 +1646,7 @@ void cv::ocl::device::hog::compute_hists(int nbins, int qangle_step = qangle.step >> qangle_step_shift; int blocks_in_group = 4; - size_t localThreads[3] = { blocks_in_group * 24, 2, 1 }; + size_t localThreads[3] = { (size_t)blocks_in_group * 24, 2, 1 }; size_t globalThreads[3] = { divUp(img_block_width * img_block_height, blocks_in_group) * localThreads[0], 2, 1 }; @@ -1791,8 +1791,8 @@ void cv::ocl::device::hog::classify_hists(int win_height, int win_width, int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x) / block_stride_x; - size_t globalThreads[3] = { img_win_width * nthreads, img_win_height, 1 }; - size_t localThreads[3] = { nthreads, 1, 1 }; + size_t globalThreads[3] = { (size_t)img_win_width * nthreads, (size_t)img_win_height, 1 }; + size_t localThreads[3] = { (size_t)nthreads, 1, 1 }; args.push_back( make_pair( sizeof(cl_int), (void *)&cblock_hist_size)); args.push_back( make_pair( sizeof(cl_int), (void *)&img_win_width)); args.push_back( make_pair( sizeof(cl_int), (void *)&img_block_width)); @@ -1837,7 +1837,7 @@ void cv::ocl::device::hog::extract_descrs_by_rows(int win_height, int win_width, block_stride_x; int descriptors_quadstep = descriptors.step >> 2; - size_t globalThreads[3] = { img_win_width * NTHREADS, img_win_height, 1 }; + size_t globalThreads[3] = { (size_t)img_win_width * NTHREADS, (size_t)img_win_height, 1 }; size_t localThreads[3] = { NTHREADS, 1, 1 }; args.push_back( make_pair( sizeof(cl_int), (void *)&cblock_hist_size)); @@ -1873,7 +1873,7 @@ void cv::ocl::device::hog::extract_descrs_by_cols(int win_height, int win_width, block_stride_x; int descriptors_quadstep = descriptors.step >> 2; - size_t globalThreads[3] = { img_win_width * NTHREADS, img_win_height, 1 }; + size_t globalThreads[3] = { (size_t)img_win_width * NTHREADS, (size_t)img_win_height, 1 }; size_t localThreads[3] = { NTHREADS, 1, 1 }; args.push_back( make_pair( sizeof(cl_int), (void *)&cblock_hist_size)); @@ -1903,7 +1903,7 @@ void cv::ocl::device::hog::compute_gradients_8UC1(int height, int width, vector< pair > args; size_t localThreads[3] = { NTHREADS, 1, 1 }; - size_t globalThreads[3] = { width, height, 1 }; + size_t globalThreads[3] = { (size_t)width, (size_t)height, 1 }; char correctGamma = (correct_gamma) ? 1 : 0; int img_step = img.step; int grad_quadstep = grad.step >> 3; @@ -1937,7 +1937,7 @@ void cv::ocl::device::hog::compute_gradients_8UC4(int height, int width, vector< pair > args; size_t localThreads[3] = { NTHREADS, 1, 1 }; - size_t globalThreads[3] = { width, height, 1 }; + size_t globalThreads[3] = { (size_t)width, (size_t)height, 1 }; char correctGamma = (correct_gamma) ? 1 : 0; int img_step = img.step >> 2; diff --git a/modules/ocl/src/imgproc.cpp b/modules/ocl/src/imgproc.cpp index 703b36de6..949df8df1 100644 --- a/modules/ocl/src/imgproc.cpp +++ b/modules/ocl/src/imgproc.cpp @@ -164,7 +164,7 @@ namespace cv args.push_back( make_pair(sizeof(cl_int), (void *)&cols)); size_t localThreads[3] = { 16, 16, 1 }; - size_t globalThreads[3] = { cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)cols, (size_t)dst.rows, 1 }; openCLExecuteKernel(src.clCxt, &imgproc_threshold, "threshold", globalThreads, localThreads, args, -1, -1, buildOptions.c_str()); @@ -229,7 +229,7 @@ namespace cv CV_Error(CV_StsBadArg, "Unsupported map types"); int ocn = dst.oclchannels(); - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; Mat scalar(1, 1, CV_MAKE_TYPE(dst.depth(), ocn), borderValue); std::string buildOptions = format("-D %s -D %s -D T=%s%s", interMap[interpolation], @@ -422,7 +422,7 @@ namespace cv } } - size_t globalThreads[3] = { glbSizeX, dst.rows, 1 }; + size_t globalThreads[3] = { glbSizeX, (size_t)dst.rows, 1 }; size_t localThreads[3] = { blkSizeX, blkSizeY, 1 }; std::vector< std::pair > args; @@ -521,7 +521,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int), (void *)&srcStep)); args.push_back( make_pair( sizeof(cl_int), (void *)&dstStep)); - size_t globalThreads[3] = {(src.cols + 18) / 16 * 16, (src.rows + 15) / 16 * 16, 1}; + size_t globalThreads[3] = {((size_t)src.cols + 18) / 16 * 16, ((size_t)src.rows + 15) / 16 * 16, 1}; size_t localThreads[3] = {16, 16, 1}; if (m == 3) @@ -589,7 +589,7 @@ namespace cv CV_Error(CV_StsBadArg, "Unsupported border type"); size_t localThreads[3] = { 16, 16, 1 }; - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; vector< pair > args; args.push_back( make_pair( sizeof(cl_mem), (void *)&_src.data)); @@ -936,7 +936,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int) , (void *)&src.cols )); args.push_back( make_pair( sizeof(cl_int) , (void *)&src.step )); args.push_back( make_pair( sizeof(cl_int) , (void *)&t_sum.step)); - size_t gt[3] = {((vcols + 1) / 2) * 256, 1, 1}, lt[3] = {256, 1, 1}; + size_t gt[3] = {(((size_t)vcols + 1) / 2) * 256, 1, 1}, lt[3] = {256, 1, 1}; openCLExecuteKernel(src.clCxt, &imgproc_integral, "integral_cols", gt, lt, args, -1, depth); args.clear(); @@ -951,7 +951,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int) , (void *)&sqsum.step)); args.push_back( make_pair( sizeof(cl_int) , (void *)&sum_offset)); args.push_back( make_pair( sizeof(cl_int) , (void *)&sqsum_offset)); - size_t gt2[3] = {t_sum.cols * 32, 1, 1}, lt2[3] = {256, 1, 1}; + size_t gt2[3] = {(size_t)t_sum.cols * 32, 1, 1}, lt2[3] = {256, 1, 1}; openCLExecuteKernel(src.clCxt, &imgproc_integral, "integral_rows", gt2, lt2, args, -1, depth); } @@ -981,7 +981,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int) , (void *)&src.cols )); args.push_back( make_pair( sizeof(cl_int) , (void *)&src.step )); args.push_back( make_pair( sizeof(cl_int) , (void *)&t_sum.step)); - size_t gt[3] = {((vcols + 1) / 2) * 256, 1, 1}, lt[3] = {256, 1, 1}; + size_t gt[3] = {(((size_t)vcols + 1) / 2) * 256, 1, 1}, lt[3] = {256, 1, 1}; openCLExecuteKernel(src.clCxt, &imgproc_integral_sum, "integral_sum_cols", gt, lt, args, -1, depth); args.clear(); @@ -992,7 +992,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int) , (void *)&t_sum.step )); args.push_back( make_pair( sizeof(cl_int) , (void *)&sum.step)); args.push_back( make_pair( sizeof(cl_int) , (void *)&sum_offset)); - size_t gt2[3] = {t_sum.cols * 32, 1, 1}, lt2[3] = {256, 1, 1}; + size_t gt2[3] = {(size_t)t_sum.cols * 32, 1, 1}, lt2[3] = {256, 1, 1}; openCLExecuteKernel(src.clCxt, &imgproc_integral_sum, "integral_sum_rows", gt2, lt2, args, -1, depth); } @@ -1025,7 +1025,7 @@ namespace cv CV_Assert(Dx.rows == Dy.rows && Dx.cols == Dy.cols); - size_t lt2[3] = {sobel_lsz, sobel_lsz, 1}; + size_t lt2[3] = {(size_t)sobel_lsz, (size_t)sobel_lsz, 1}; size_t gt2[3] = {lt2[0]*(1 + (src.cols-1) / lt2[0]), lt2[1]*(1 + (src.rows-1) / lt2[1]), 1}; unsigned int src_pitch = src.step; @@ -1247,8 +1247,8 @@ namespace cv if (src.rows % lty != 0) row = (row / lty + 1) * lty; - size_t globalThreads[3] = {col, row, 1}; - size_t localThreads[3] = {ltx, lty, 1}; + size_t globalThreads[3] = {(size_t)col, (size_t)row, 1}; + size_t localThreads[3] = {(size_t)ltx, (size_t)lty, 1}; //set args vector > args; @@ -1306,8 +1306,8 @@ namespace cv if (src.rows % lty != 0) row = (row / lty + 1) * lty; - size_t globalThreads[3] = {col, row, 1}; - size_t localThreads[3] = {ltx, lty, 1}; + size_t globalThreads[3] = {(size_t)col, (size_t)row, 1}; + size_t localThreads[3] = {(size_t)ltx, (size_t)lty, 1}; //set args vector > args; @@ -1567,7 +1567,7 @@ namespace cv args.push_back( std::make_pair( sizeof(cl_int), (void *)&lut.offset )); size_t localThreads[3] = { 32, 8, 1 }; - size_t globalThreads[3] = { src.cols, src.rows, 1 }; + size_t globalThreads[3] = { (size_t)src.cols, (size_t)src.rows, 1 }; openCLExecuteKernel(Context::getContext(), &imgproc_clahe, "transform", globalThreads, localThreads, args, -1, -1); } @@ -1754,7 +1754,7 @@ namespace cv #else size_t localThreads[3] = { 16, 16, 1 }; #endif - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; if ((dst.type() == CV_8UC1) && ((dst.offset & 3) == 0) && ((dst.cols & 3) == 0)) { @@ -1799,7 +1799,7 @@ static void convolve_run(const oclMat &src, const oclMat &temp1, oclMat &dst, st dst.create(src.size(), src.type()); size_t localThreads[3] = { 16, 16, 1 }; - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; int src_step = src.step / src.elemSize(), src_offset = src.offset / src.elemSize(); int dst_step = dst.step / dst.elemSize(), dst_offset = dst.offset / dst.elemSize(); diff --git a/modules/ocl/src/interpolate_frames.cpp b/modules/ocl/src/interpolate_frames.cpp index db78e85c7..1d79d4b91 100644 --- a/modules/ocl/src/interpolate_frames.cpp +++ b/modules/ocl/src/interpolate_frames.cpp @@ -141,7 +141,7 @@ void interpolate::memsetKernel(float val, oclMat &img, int height, int offset) args.push_back( make_pair( sizeof(cl_int), (void *)&step)); args.push_back( make_pair( sizeof(cl_int), (void *)&offset)); - size_t globalThreads[3] = {img.cols, height, 1}; + size_t globalThreads[3] = {(size_t)img.cols, (size_t)height, 1}; size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &interpolate_frames, kernelName, globalThreads, localThreads, args, -1, -1); } @@ -161,7 +161,7 @@ void interpolate::normalizeKernel(oclMat &buffer, int height, int factor_offset, args.push_back( make_pair( sizeof(cl_int), (void *)&factor_offset)); args.push_back( make_pair( sizeof(cl_int), (void *)&dst_offset)); - size_t globalThreads[3] = {buffer.cols, height, 1}; + size_t globalThreads[3] = {(size_t)buffer.cols, (size_t)height, 1}; size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &interpolate_frames, kernelName, globalThreads, localThreads, args, -1, -1); } @@ -190,7 +190,7 @@ void interpolate::forwardWarpKernel(const oclMat &src, oclMat &buffer, const ocl args.push_back( make_pair( sizeof(cl_int), (void *)&d_offset)); args.push_back( make_pair( sizeof(cl_float), (void *)&time_scale)); - size_t globalThreads[3] = {src.cols, src.rows, 1}; + size_t globalThreads[3] = {(size_t)src.cols, (size_t)src.rows, 1}; size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &interpolate_frames, kernelName, globalThreads, localThreads, args, -1, -1); } @@ -220,7 +220,7 @@ void interpolate::blendFrames(const oclMat &frame0, const oclMat &/*frame1*/, co args.push_back( make_pair( sizeof(cl_int), (void *)&step)); args.push_back( make_pair( sizeof(cl_float), (void *)&pos)); - size_t globalThreads[3] = {frame0.cols, frame0.rows, 1}; + size_t globalThreads[3] = {(size_t)frame0.cols, (size_t)frame0.rows, 1}; size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &interpolate_frames, kernelName, globalThreads, localThreads, args, -1, -1); } diff --git a/modules/ocl/src/kmeans.cpp b/modules/ocl/src/kmeans.cpp index 31fb2503d..10fafa034 100644 --- a/modules/ocl/src/kmeans.cpp +++ b/modules/ocl/src/kmeans.cpp @@ -195,7 +195,7 @@ void cv::ocl::distanceToCenters(const oclMat &src, const oclMat ¢ers, Mat &d args.push_back(make_pair(sizeof(cl_int), (void *)&src_offset)); args.push_back(make_pair(sizeof(cl_int), (void *)¢ers_offset)); - size_t globalThreads[3] = { all_dist_count, 1, 1 }; + size_t globalThreads[3] = { (size_t)all_dist_count, 1, 1 }; openCLExecuteKernel(Context::getContext(), &kmeans_kernel, "distanceToCenters", globalThreads, NULL, args, -1, -1, build_opt_ss.str().c_str()); diff --git a/modules/ocl/src/knearest.cpp b/modules/ocl/src/knearest.cpp index 17c8cd459..6b1f31ab6 100644 --- a/modules/ocl/src/knearest.cpp +++ b/modules/ocl/src/knearest.cpp @@ -93,13 +93,13 @@ bool KNearestNeighbour::train(const Mat& trainData, Mat& labels, Mat& sampleIdx, return cv_knn_train; } -void KNearestNeighbour::find_nearest(const oclMat& samples, int k, oclMat& lables) +void KNearestNeighbour::find_nearest(const oclMat& lsamples, int k, oclMat& lables) { CV_Assert(!samples_ocl.empty()); - lables.create(samples.rows, 1, CV_32FC1); + lables.create(lsamples.rows, 1, CV_32FC1); - CV_Assert(samples.cols == CvKNearest::var_count); - CV_Assert(samples.type() == CV_32FC1); + CV_Assert(lsamples.cols == CvKNearest::var_count); + CV_Assert(lsamples.type() == CV_32FC1); CV_Assert(k >= 1 && k <= max_k); int k1 = KNearest::get_sample_count(); @@ -112,8 +112,8 @@ void KNearestNeighbour::find_nearest(const oclMat& samples, int k, oclMat& lable nThreads = 256; int smem_size = nThreads * k * 4 * 2; - size_t local_thread[] = {1, nThreads, 1}; - size_t global_thread[] = {1, samples.rows, 1}; + size_t local_thread[] = {1, (size_t)nThreads, 1}; + size_t global_thread[] = {1, (size_t)lsamples.rows, 1}; char build_option[50]; if(!Context::getContext()->supportsFeature(FEATURE_CL_DOUBLE)) @@ -125,16 +125,16 @@ void KNearestNeighbour::find_nearest(const oclMat& samples, int k, oclMat& lable std::vector< std::pair > args; int samples_ocl_step = samples_ocl.step/samples_ocl.elemSize(); - int samples_step = samples.step/samples.elemSize(); + int samples_step = lsamples.step/lsamples.elemSize(); int lables_step = lables.step/lables.elemSize(); int _regression = 0; if(CvKNearest::regression) _regression = 1; - args.push_back(make_pair(sizeof(cl_mem), (void*)&samples.data)); - args.push_back(make_pair(sizeof(cl_int), (void*)&samples.rows)); - args.push_back(make_pair(sizeof(cl_int), (void*)&samples.cols)); + args.push_back(make_pair(sizeof(cl_mem), (void*)&lsamples.data)); + args.push_back(make_pair(sizeof(cl_int), (void*)&lsamples.rows)); + args.push_back(make_pair(sizeof(cl_int), (void*)&lsamples.cols)); args.push_back(make_pair(sizeof(cl_int), (void*)&samples_step)); args.push_back(make_pair(sizeof(cl_int), (void*)&k)); args.push_back(make_pair(sizeof(cl_mem), (void*)&samples_ocl.data)); @@ -148,4 +148,4 @@ void KNearestNeighbour::find_nearest(const oclMat& samples, int k, oclMat& lable args.push_back(make_pair(sizeof(cl_int), (void*)&nThreads)); args.push_back(make_pair(smem_size, (void*)NULL)); openCLExecuteKernel(Context::getContext(), &knearest, kernel_name, global_thread, local_thread, args, -1, -1, build_option); -} \ No newline at end of file +} diff --git a/modules/ocl/src/match_template.cpp b/modules/ocl/src/match_template.cpp index afd68ffe4..6a3e86ea2 100644 --- a/modules/ocl/src/match_template.cpp +++ b/modules/ocl/src/match_template.cpp @@ -136,7 +136,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int), (void *)&result.offset)); args.push_back( make_pair( sizeof(cl_int), (void *)&result.step)); - size_t globalThreads[3] = {result.cols, result.rows, 1}; + size_t globalThreads[3] = {(size_t)result.cols, (size_t)result.rows, 1}; size_t localThreads[3] = {16, 16, 1}; const char * build_opt = image.oclchannels() == 4 ? "-D CN4" : ""; @@ -170,7 +170,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int), (void *)&result.offset)); args.push_back( make_pair( sizeof(cl_int), (void *)&result.step)); - size_t globalThreads[3] = {result.cols, result.rows, 1}; + size_t globalThreads[3] = {(size_t)result.cols, (size_t)result.rows, 1}; size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &match_template, kernelName, globalThreads, localThreads, args, 1, CV_8U); } @@ -205,7 +205,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int), (void *)&templ.step)); args.push_back( make_pair( sizeof(cl_int), (void *)&result.step)); - size_t globalThreads[3] = {result.cols, result.rows, 1}; + size_t globalThreads[3] = {(size_t)result.cols, (size_t)result.rows, 1}; size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &match_template, kernelName, globalThreads, localThreads, args, image.oclchannels(), image.depth()); } @@ -269,7 +269,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int), (void *)&result.offset)); args.push_back( make_pair( sizeof(cl_int), (void *)&result.step)); - size_t globalThreads[3] = {result.cols, result.rows, 1}; + size_t globalThreads[3] = {(size_t)result.cols, (size_t)result.rows, 1}; size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &match_template, kernelName, globalThreads, localThreads, args, 1, CV_8U); } @@ -304,7 +304,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int), (void *)&templ.step)); args.push_back( make_pair( sizeof(cl_int), (void *)&result.step)); - size_t globalThreads[3] = {result.cols, result.rows, 1}; + size_t globalThreads[3] = {(size_t)result.cols, (size_t)result.rows, 1}; size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &match_template, kernelName, globalThreads, localThreads, args, image.oclchannels(), image.depth()); } @@ -321,7 +321,7 @@ namespace cv string kernelName; kernelName = "matchTemplate_Prepared_CCOFF"; - size_t globalThreads[3] = {result.cols, result.rows, 1}; + size_t globalThreads[3] = {(size_t)result.cols, (size_t)result.rows, 1}; size_t localThreads[3] = {16, 16, 1}; vector< pair > args; @@ -394,7 +394,7 @@ namespace cv string kernelName; kernelName = "matchTemplate_Prepared_CCOFF_NORMED"; - size_t globalThreads[3] = {result.cols, result.rows, 1}; + size_t globalThreads[3] = {(size_t)result.cols, (size_t)result.rows, 1}; size_t localThreads[3] = {16, 16, 1}; vector< pair > args; @@ -492,7 +492,7 @@ namespace cv string kernelName; kernelName = "extractFirstChannel"; - size_t globalThreads[3] = {result.cols, result.rows, 1}; + size_t globalThreads[3] = {(size_t)result.cols, (size_t)result.rows, 1}; size_t localThreads[3] = {16, 16, 1}; vector< pair > args; diff --git a/modules/ocl/src/matrix_operations.cpp b/modules/ocl/src/matrix_operations.cpp index 66b20a543..331e432e6 100644 --- a/modules/ocl/src/matrix_operations.cpp +++ b/modules/ocl/src/matrix_operations.cpp @@ -238,7 +238,7 @@ static void copy_to_with_mask(const oclMat &src, oclMat &dst, const oclMat &mask char compile_option[32]; sprintf(compile_option, "-D GENTYPE=%s", string_types[dst.oclchannels() - 1][dst.depth()].c_str()); size_t localThreads[3] = {16, 16, 1}; - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; int dststep_in_pixel = dst.step / dst.elemSize(), dstoffset_in_pixel = dst.offset / dst.elemSize(); int srcstep_in_pixel = src.step / src.elemSize(), srcoffset_in_pixel = src.offset / src.elemSize(); @@ -426,7 +426,7 @@ static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, stri vector > args; size_t localThreads[3] = {16, 16, 1}; - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; int step_in_pixel = dst.step / dst.elemSize(), offset_in_pixel = dst.offset / dst.elemSize(); if (dst.type() == CV_8UC1) @@ -469,7 +469,7 @@ static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const o CV_DbgAssert( dst.rows == mask.rows && dst.cols == mask.cols); vector > args; size_t localThreads[3] = { 16, 16, 1 }; - size_t globalThreads[3] = { dst.cols, dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)dst.cols, (size_t)dst.rows, 1 }; int step_in_pixel = dst.step / dst.elemSize(), offset_in_pixel = dst.offset / dst.elemSize(); const char * const typeMap[] = { "uchar", "char", "ushort", "short", "int", "float", "double" }; diff --git a/modules/ocl/src/mcwutil.cpp b/modules/ocl/src/mcwutil.cpp index 7158dc72c..82fc18f4c 100644 --- a/modules/ocl/src/mcwutil.cpp +++ b/modules/ocl/src/mcwutil.cpp @@ -184,14 +184,14 @@ namespace cv &err); } size_t origin[] = { 0, 0, 0 }; - size_t region[] = { mat.cols, mat.rows, 1 }; + size_t region[] = { (size_t)mat.cols, (size_t)mat.rows, 1 }; cl_mem devData; if (mat.cols * mat.elemSize() != mat.step) { devData = clCreateBuffer(*(cl_context*)mat.clCxt->getOpenCLContextPtr(), CL_MEM_READ_ONLY, mat.cols * mat.rows * mat.elemSize(), NULL, NULL); - const size_t regin[3] = {mat.cols * mat.elemSize(), mat.rows, 1}; + const size_t regin[3] = {(size_t)mat.cols * mat.elemSize(), (size_t)mat.rows, 1}; clEnqueueCopyBufferRect(*(cl_command_queue*)mat.clCxt->getOpenCLCommandQueuePtr(), (cl_mem)mat.data, devData, origin, origin, regin, mat.step, 0, mat.cols * mat.elemSize(), 0, 0, NULL, NULL); clFlush(*(cl_command_queue*)mat.clCxt->getOpenCLCommandQueuePtr()); diff --git a/modules/ocl/src/moments.cpp b/modules/ocl/src/moments.cpp index 216e9ab29..f8f1e8706 100644 --- a/modules/ocl/src/moments.cpp +++ b/modules/ocl/src/moments.cpp @@ -54,42 +54,42 @@ namespace cv namespace ocl { // The function calculates center of gravity and the central second order moments - static void icvCompleteMomentState( CvMoments* moments ) + static void icvCompleteMomentState( CvMoments* lmoments ) { double cx = 0, cy = 0; double mu20, mu11, mu02; - assert( moments != 0 ); - moments->inv_sqrt_m00 = 0; + assert( lmoments != 0 ); + lmoments->inv_sqrt_m00 = 0; - if( fabs(moments->m00) > DBL_EPSILON ) + if( fabs(lmoments->m00) > DBL_EPSILON ) { - double inv_m00 = 1. / moments->m00; - cx = moments->m10 * inv_m00; - cy = moments->m01 * inv_m00; - moments->inv_sqrt_m00 = std::sqrt( fabs(inv_m00) ); + double inv_m00 = 1. / lmoments->m00; + cx = lmoments->m10 * inv_m00; + cy = lmoments->m01 * inv_m00; + lmoments->inv_sqrt_m00 = std::sqrt( fabs(inv_m00) ); } // mu20 = m20 - m10*cx - mu20 = moments->m20 - moments->m10 * cx; + mu20 = lmoments->m20 - lmoments->m10 * cx; // mu11 = m11 - m10*cy - mu11 = moments->m11 - moments->m10 * cy; + mu11 = lmoments->m11 - lmoments->m10 * cy; // mu02 = m02 - m01*cy - mu02 = moments->m02 - moments->m01 * cy; + mu02 = lmoments->m02 - lmoments->m01 * cy; - moments->mu20 = mu20; - moments->mu11 = mu11; - moments->mu02 = mu02; + lmoments->mu20 = mu20; + lmoments->mu11 = mu11; + lmoments->mu02 = mu02; // mu30 = m30 - cx*(3*mu20 + cx*m10) - moments->mu30 = moments->m30 - cx * (3 * mu20 + cx * moments->m10); + lmoments->mu30 = lmoments->m30 - cx * (3 * mu20 + cx * lmoments->m10); mu11 += mu11; // mu21 = m21 - cx*(2*mu11 + cx*m01) - cy*mu20 - moments->mu21 = moments->m21 - cx * (mu11 + cx * moments->m01) - cy * mu20; + lmoments->mu21 = lmoments->m21 - cx * (mu11 + cx * lmoments->m01) - cy * mu20; // mu12 = m12 - cy*(2*mu11 + cy*m10) - cx*mu02 - moments->mu12 = moments->m12 - cy * (mu11 + cy * moments->m10) - cx * mu02; + lmoments->mu12 = lmoments->m12 - cy * (mu11 + cy * lmoments->m10) - cx * mu02; // mu03 = m03 - cy*(3*mu02 + cy*m01) - moments->mu03 = moments->m03 - cy * (3 * mu02 + cy * moments->m01); + lmoments->mu03 = lmoments->m03 - cy * (3 * mu02 + cy * lmoments->m01); } @@ -135,8 +135,8 @@ namespace cv cv::ocl::oclMat dst_a(10, lpt, CV_64FC1); cv::ocl::oclMat reader_oclmat(reader_mat); int llength = std::min(lpt,128); - size_t localThreads[3] = { llength, 1, 1}; - size_t globalThreads[3] = { lpt, 1, 1}; + size_t localThreads[3] = { (size_t)llength, 1, 1}; + size_t globalThreads[3] = { (size_t)lpt, 1, 1}; vector > args; args.push_back( make_pair( sizeof(cl_int) , (void *)&contour->total )); args.push_back( make_pair( sizeof(cl_mem) , (void *)&reader_oclmat.data )); @@ -252,8 +252,8 @@ namespace cv oclMat dst_m; int tile_height = TILE_SIZE; - size_t localThreads[3] = {1, tile_height, 1}; - size_t globalThreads[3] = {blockx, size.height, 1}; + size_t localThreads[3] = {1, (size_t)tile_height, 1}; + size_t globalThreads[3] = {(size_t)blockx, (size_t)size.height, 1}; if(Context::getContext()->supportsFeature(FEATURE_CL_DOUBLE)) { diff --git a/modules/ocl/src/optical_flow_farneback.cpp b/modules/ocl/src/optical_flow_farneback.cpp index d9006eabe..a110887a1 100644 --- a/modules/ocl/src/optical_flow_farneback.cpp +++ b/modules/ocl/src/optical_flow_farneback.cpp @@ -66,7 +66,7 @@ static void updateMatricesOcl(const oclMat &flowx, const oclMat &flowy, const oc #else size_t localThreads[3] = { 32, 8, 1 }; #endif - size_t globalThreads[3] = { flowx.cols, flowx.rows, 1 }; + size_t globalThreads[3] = { (size_t)flowx.cols, (size_t)flowx.rows, 1 }; std::vector< std::pair > args; args.push_back(std::make_pair(sizeof(cl_mem), (void *)&M.data)); @@ -95,7 +95,7 @@ static void boxFilter5Ocl(const oclMat &src, int ksizeHalf, oclMat &dst) #else size_t localThreads[3] = { 256, 1, 1 }; #endif - size_t globalThreads[3] = { src.cols, height, 1 }; + size_t globalThreads[3] = { (size_t)src.cols, (size_t)height, 1 }; int smem_size = (localThreads[0] + 2*ksizeHalf) * 5 * sizeof(float); std::vector< std::pair > args; @@ -121,7 +121,7 @@ static void updateFlowOcl(const oclMat &M, oclMat &flowx, oclMat &flowy) #else size_t localThreads[3] = { 32, 8, 1 }; #endif - size_t globalThreads[3] = { cols, flowx.rows, 1 }; + size_t globalThreads[3] = { (size_t)cols, (size_t)flowx.rows, 1 }; std::vector< std::pair > args; args.push_back(std::make_pair(sizeof(cl_mem), (void *)&flowx.data)); @@ -161,7 +161,7 @@ void cv::ocl::FarnebackOpticalFlow::gaussianBlurOcl(const oclMat &src, int ksize #else size_t localThreads[3] = { 256, 1, 1 }; #endif - size_t globalThreads[3] = { src.cols, src.rows, 1 }; + size_t globalThreads[3] = { (size_t)src.cols, (size_t)src.rows, 1 }; int smem_size = (localThreads[0] + 2*ksizeHalf) * sizeof(float); CV_Assert(dst.size() == src.size()); @@ -180,7 +180,7 @@ void cv::ocl::FarnebackOpticalFlow::gaussianBlurOcl(const oclMat &src, int ksize globalThreads, localThreads, args, -1, -1); } -void cv::ocl::FarnebackOpticalFlow::polynomialExpansionOcl(const oclMat &src, int polyN, oclMat &dst) +void cv::ocl::FarnebackOpticalFlow::polynomialExpansionOcl(const oclMat &src, int lpolyN, oclMat &dst) { string kernelName("polynomialExpansion"); @@ -189,7 +189,7 @@ void cv::ocl::FarnebackOpticalFlow::polynomialExpansionOcl(const oclMat &src, in #else size_t localThreads[3] = { 256, 1, 1 }; #endif - size_t globalThreads[3] = { divUp(src.cols, localThreads[0] - 2*polyN) * localThreads[0], src.rows, 1 }; + size_t globalThreads[3] = { divUp(src.cols, localThreads[0] - 2*lpolyN) * localThreads[0], (size_t)src.rows, 1 }; int smem_size = 3 * localThreads[0] * sizeof(float); std::vector< std::pair > args; @@ -206,7 +206,7 @@ void cv::ocl::FarnebackOpticalFlow::polynomialExpansionOcl(const oclMat &src, in args.push_back(std::make_pair(sizeof(cl_int), (void *)&src.step)); char opt [128]; - sprintf(opt, "-D polyN=%d", polyN); + sprintf(opt, "-D polyN=%d", lpolyN); openCLExecuteKernel(Context::getContext(), &optical_flow_farneback, kernelName, globalThreads, localThreads, args, -1, -1, opt); @@ -221,7 +221,7 @@ void cv::ocl::FarnebackOpticalFlow::gaussianBlur5Ocl(const oclMat &src, int ksiz #else size_t localThreads[3] = { 256, 1, 1 }; #endif - size_t globalThreads[3] = { src.cols, height, 1 }; + size_t globalThreads[3] = { (size_t)src.cols, (size_t)height, 1 }; int smem_size = (localThreads[0] + 2*ksizeHalf) * 5 * sizeof(float); std::vector< std::pair > args; diff --git a/modules/ocl/src/pyrdown.cpp b/modules/ocl/src/pyrdown.cpp index 069a33dd6..b54c38d08 100644 --- a/modules/ocl/src/pyrdown.cpp +++ b/modules/ocl/src/pyrdown.cpp @@ -63,7 +63,7 @@ static void pyrdown_run(const oclMat &src, const oclMat &dst) string kernelName = "pyrDown"; size_t localThreads[3] = { 256, 1, 1 }; - size_t globalThreads[3] = { src.cols, dst.rows, 1}; + size_t globalThreads[3] = { (size_t)src.cols, (size_t)dst.rows, 1}; vector > args; args.push_back( make_pair( sizeof(cl_mem), (void *)&src.data )); diff --git a/modules/ocl/src/pyrlk.cpp b/modules/ocl/src/pyrlk.cpp index 064fee9ac..c0098da99 100644 --- a/modules/ocl/src/pyrlk.cpp +++ b/modules/ocl/src/pyrlk.cpp @@ -84,7 +84,7 @@ static void lkSparse_run(oclMat &I, oclMat &J, Context *clCxt = I.clCxt; string kernelName = "lkSparse"; size_t localThreads[3] = { 8, 8, 1 }; - size_t globalThreads[3] = { 8 * ptcount, 8, 1}; + size_t globalThreads[3] = { 8 * (size_t)ptcount, 8, 1}; int cn = I.oclchannels(); char calcErr = level==0?1:0; @@ -217,7 +217,7 @@ static void lkDense_run(oclMat &I, oclMat &J, oclMat &u, oclMat &v, string kernelName = "lkDense"; size_t localThreads[3] = { 16, 16, 1 }; - size_t globalThreads[3] = { I.cols, I.rows, 1}; + size_t globalThreads[3] = { (size_t)I.cols, (size_t)I.rows, 1}; cl_char calcErr = err ? 1 : 0; diff --git a/modules/ocl/src/pyrup.cpp b/modules/ocl/src/pyrup.cpp index 8c60f96de..b2336e218 100644 --- a/modules/ocl/src/pyrup.cpp +++ b/modules/ocl/src/pyrup.cpp @@ -93,7 +93,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int), (void *)&srcstep)); args.push_back( make_pair( sizeof(cl_int), (void *)&dststep)); - size_t globalThreads[3] = {dst.cols, dst.rows, 1}; + size_t globalThreads[3] = {(size_t)dst.cols, (size_t)dst.rows, 1}; size_t localThreads[3] = {16, 16, 1}; diff --git a/modules/ocl/src/sort_by_key.cpp b/modules/ocl/src/sort_by_key.cpp index 596f94e1c..b1a05908a 100644 --- a/modules/ocl/src/sort_by_key.cpp +++ b/modules/ocl/src/sort_by_key.cpp @@ -358,18 +358,18 @@ static void sortByKey(oclMat& keys, oclMat& vals, size_t vecSize, bool isGreater { Context * cxt = Context::getContext(); - const size_t GROUP_SIZE = cxt->getDeviceInfo().maxWorkGroupSize >= 256 ? 256: 128; + const size_t groupSize = cxt->getDeviceInfo().maxWorkGroupSize >= 256 ? 256: 128; size_t globalThreads[3] = {vecSize, 1, 1}; - size_t localThreads[3] = {GROUP_SIZE, 1, 1}; + size_t localThreads[3] = {groupSize, 1, 1}; std::vector< std::pair > args; char build_opt_buf [100]; genSortBuildOption(keys, vals, isGreaterThan, build_opt_buf); String kernelname[] = {String("blockInsertionSort"), String("merge")}; - int keylds_size = GROUP_SIZE * keys.elemSize(); - int vallds_size = GROUP_SIZE * vals.elemSize(); + int keylds_size = groupSize * keys.elemSize(); + int vallds_size = groupSize * vals.elemSize(); args.push_back(std::make_pair(sizeof(cl_mem), (void *)&keys.data)); args.push_back(std::make_pair(sizeof(cl_mem), (void *)&vals.data)); args.push_back(std::make_pair(sizeof(cl_uint), (void *)&vecSize)); @@ -379,7 +379,7 @@ static void sortByKey(oclMat& keys, oclMat& vals, size_t vecSize, bool isGreater openCLExecuteKernel(cxt, &kernel_stablesort_by_key, kernelname[0], globalThreads, localThreads, args, -1, -1, build_opt_buf); // Early exit for the case of no merge passes, values are already in destination vector - if(vecSize <= GROUP_SIZE) + if(vecSize <= groupSize) { return; } diff --git a/modules/ocl/src/split_merge.cpp b/modules/ocl/src/split_merge.cpp index 400a05579..5d98ddbd1 100644 --- a/modules/ocl/src/split_merge.cpp +++ b/modules/ocl/src/split_merge.cpp @@ -80,7 +80,7 @@ namespace cv int cols = divUp(mat_dst.cols + offset_cols, vector_length); size_t localThreads[3] = { 64, 4, 1 }; - size_t globalThreads[3] = { cols, mat_dst.rows, 1 }; + size_t globalThreads[3] = { (size_t)cols, (size_t)mat_dst.rows, 1 }; int dst_step1 = mat_dst.cols * mat_dst.elemSize(); vector > args; @@ -254,7 +254,7 @@ namespace cv || devInfo.deviceVersion.find("Build 78712") != std::string::npos)) build_options += " -D BYPASS_VSTORE=true"; - size_t globalThreads[3] = { divUp(src.cols, VEC_SIZE), src.rows, 1 }; + size_t globalThreads[3] = { divUp(src.cols, VEC_SIZE), (size_t)src.rows, 1 }; openCLExecuteKernel(clCtx, &split_mat, kernelName, globalThreads, NULL, args, -1, -1, build_options.c_str()); } static void split(const oclMat &mat_src, oclMat *mat_dst) diff --git a/modules/ocl/src/stereo_csbp.cpp b/modules/ocl/src/stereo_csbp.cpp index cfe03b20c..409d6f21c 100644 --- a/modules/ocl/src/stereo_csbp.cpp +++ b/modules/ocl/src/stereo_csbp.cpp @@ -133,7 +133,7 @@ namespace cv const int threadsNum = 256; //size_t blockSize = threadsNum; - size_t localThreads[3] = {win_size, 1, threadsNum / win_size}; + size_t localThreads[3] = {(size_t)win_size, 1, (size_t)threadsNum / win_size}; size_t globalThreads[3] = { w *localThreads[0], h * divUp(rthis.ndisp, localThreads[2]) *localThreads[1], 1 * localThreads[2] }; @@ -316,7 +316,7 @@ namespace cv const size_t threadsNum = 256; //size_t blockSize = threadsNum; - size_t localThreads[3] = { win_size, 1, threadsNum / win_size }; + size_t localThreads[3] = { (size_t)win_size, 1, (size_t)threadsNum / win_size }; size_t globalThreads[3] = { w *localThreads[0], h * divUp(nr_plane, localThreads[2]) *localThreads[1], 1 * localThreads[2] }; diff --git a/modules/ocl/src/stereobm.cpp b/modules/ocl/src/stereobm.cpp index c567e2271..119548bc6 100644 --- a/modules/ocl/src/stereobm.cpp +++ b/modules/ocl/src/stereobm.cpp @@ -65,7 +65,7 @@ static void prefilter_xsobel(const oclMat &input, oclMat &output, int prefilterC string kernelName = "prefilter_xsobel"; size_t blockSize = 1; - size_t globalThreads[3] = { input.cols, input.rows, 1 }; + size_t globalThreads[3] = { (size_t)input.cols, (size_t)input.rows, 1 }; size_t localThreads[3] = { blockSize, blockSize, 1 }; std::vector< std::pair > args; @@ -103,7 +103,7 @@ static void stereo_bm(const oclMat &left, const oclMat &right, oclMat &disp, sizeof(cl_uint); //size_t blockSize = 1; size_t localThreads[] = { BLOCK_W, 1, 1 }; - size_t globalThreads[] = { left.cols - maxdisp - 2 * winsz2, + size_t globalThreads[] = { (size_t)left.cols - maxdisp - 2 * winsz2, divUp(left.rows - 2 * winsz2, ROWSperTHREAD), 1 }; @@ -135,7 +135,7 @@ static void postfilter_textureness(oclMat &left, int winSize, size_t blockSize = 1; size_t localThreads[] = { BLOCK_W, blockSize ,1}; - size_t globalThreads[] = { left.cols, + size_t globalThreads[] = { (size_t)left.cols, divUp(left.rows, 2 * ROWSperTHREAD), 1 }; diff --git a/modules/ocl/src/stereobp.cpp b/modules/ocl/src/stereobp.cpp index 5d128d630..7a3ead1c7 100644 --- a/modules/ocl/src/stereobp.cpp +++ b/modules/ocl/src/stereobp.cpp @@ -116,7 +116,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int) , (void *)&data.step)); args.push_back( make_pair( sizeof(cl_mem) , (void *)&cl_con_struct)); - size_t gt[3] = {left.cols, left.rows, 1}, lt[3] = {16, 16, 1}; + size_t gt[3] = {(size_t)left.cols, (size_t)left.rows, 1}, lt[3] = {16, 16, 1}; const int OPT_SIZE = 50; char cn_opt [OPT_SIZE] = ""; @@ -148,7 +148,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int) , (void *)&dst.step)); args.push_back( make_pair( sizeof(cl_int) , (void *)&disp)); - size_t gt[3] = {dst_cols, dst_rows, 1}, lt[3] = {16, 16, 1}; + size_t gt[3] = {(size_t)dst_cols, (size_t)dst_rows, 1}, lt[3] = {16, 16, 1}; const char* t_opt = data_type == CV_16S ? "-D T_SHORT":"-D T_FLOAT"; openCLExecuteKernel(clCxt, &stereobp, kernelName, gt, lt, args, -1, -1, t_opt); } @@ -173,7 +173,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int) , (void *)&dst.step)); args.push_back( make_pair( sizeof(cl_int) , (void *)&ndisp)); - size_t gt[3] = {dst_cols, dst_rows, 1}, lt[3] = {16, 16, 1}; + size_t gt[3] = {(size_t)dst_cols, (size_t)dst_rows, 1}, lt[3] = {16, 16, 1}; const char* t_opt = data_type == CV_16S ? "-D T_SHORT":"-D T_FLOAT"; openCLExecuteKernel(clCxt, &stereobp, kernelName, gt, lt, args, -1, -1, t_opt); } @@ -223,7 +223,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_float) , (void *)&cmax_disc_term)); args.push_back( make_pair( sizeof(cl_float) , (void *)&cdisc_single_jump)); - size_t gt[3] = {cols, rows, 1}, lt[3] = {16, 16, 1}; + size_t gt[3] = {(size_t)cols, (size_t)rows, 1}, lt[3] = {16, 16, 1}; char opt[80] = ""; sprintf(opt, "-D %s -D CNDISP=%d", data_type == CV_16S ? "T_SHORT":"T_FLOAT", cndisp); openCLExecuteKernel(clCxt, &stereobp, kernelName, gt, lt, args, -1, -1, opt); @@ -263,7 +263,7 @@ namespace cv args.push_back( make_pair( sizeof(cl_int) , (void *)&disp.step)); args.push_back( make_pair( sizeof(cl_int) , (void *)&ndisp)); - size_t gt[3] = {disp.cols, disp.rows, 1}, lt[3] = {16, 16, 1}; + size_t gt[3] = {(size_t)disp.cols, (size_t)disp.rows, 1}, lt[3] = {16, 16, 1}; const char* t_opt = data_type == CV_16S ? "-D T_SHORT":"-D T_FLOAT"; openCLExecuteKernel(clCxt, &stereobp, kernelName, gt, lt, args, -1, -1, t_opt); } diff --git a/modules/ocl/src/svm.cpp b/modules/ocl/src/svm.cpp index 3e51d8691..042bad818 100644 --- a/modules/ocl/src/svm.cpp +++ b/modules/ocl/src/svm.cpp @@ -443,8 +443,8 @@ static void matmul_sigmod(oclMat & src, oclMat & src2, oclMat & dst, int src_row int dst_step = (int)dst.step / dst.elemSize(); int x = MIN(16, src_rows); int y = MIN(16, src2_cols); - size_t localThreads[] = {x, y, 1}; - size_t globalThreads[] = {src2_cols, src_rows, 1}; + size_t localThreads[] = {(size_t)x, (size_t)y, 1}; + size_t globalThreads[] = {(size_t)src2_cols, (size_t)src_rows, 1}; int width = var_count; vector< pair > args; @@ -483,8 +483,8 @@ static void matmul_poly(oclMat & src, oclMat & src2, oclMat & dst, int src_rows, int dst_step = (int)dst.step / dst.elemSize(); int x = MIN(16, src_rows); int y = MIN(16, src2_cols); - size_t localThreads[] = {x, y, 1}; - size_t globalThreads[] = {src2_cols, src_rows, 1}; + size_t localThreads[] = {(size_t)x, (size_t)y, 1}; + size_t globalThreads[] = {(size_t)src2_cols, (size_t)src_rows, 1}; int width = var_count; char build_options[50]; @@ -532,8 +532,8 @@ static void matmul_linear(oclMat & src, oclMat & src2, oclMat & dst, int src_row int dst_step = (int)dst.step / dst.elemSize(); int x = MIN(16, src_rows); int y = MIN(16, src2_cols); - size_t localThreads[] = {x, y, 1}; - size_t globalThreads[] = {src2_cols, src_rows, 1}; + size_t localThreads[] = {(size_t)x, (size_t)y, 1}; + size_t globalThreads[] = {(size_t)src2_cols, (size_t)src_rows, 1}; int width = var_count; vector< pair > args; @@ -579,8 +579,8 @@ static void matmul_rbf(oclMat& src, oclMat& src_e, oclMat& dst, int src_rows, in int x = MIN(16, src_rows); int y = MIN(16, src2_cols); - size_t localThreads[] = {x, y, 1}; - size_t globalThreads[] = {src2_cols, src_rows, 1}; + size_t localThreads[] = {(size_t)x, (size_t)y, 1}; + size_t globalThreads[] = {(size_t)src2_cols, (size_t)src_rows, 1}; char build_options[50]; if(flag) @@ -788,11 +788,11 @@ bool CvSVMSolver_ocl::solve_generic( CvSVMSolutionInfo& si ) } Mat src1 = Mat(sample_count, var_count, CV_32FC1); - for(int i = 0; i < sample_count; ++i) + for(int i2 = 0; i2 < sample_count; ++i2) { - for(int j = 0; j < var_count; ++j) + for(int j2 = 0; j2 < var_count; ++j2) { - src1.at(i, j) = samples[i][j]; + src1.at(i2, j2) = samples[i2][j2]; } } oclMat src, src_e; diff --git a/modules/ocl/src/tvl1flow.cpp b/modules/ocl/src/tvl1flow.cpp index d063a5893..983f4e862 100644 --- a/modules/ocl/src/tvl1flow.cpp +++ b/modules/ocl/src/tvl1flow.cpp @@ -273,7 +273,7 @@ void ocl_tvl1flow::centeredGradient(const oclMat &src, oclMat &dx, oclMat &dy) { Context *clCxt = src.clCxt; size_t localThreads[3] = {32, 8, 1}; - size_t globalThreads[3] = {src.cols, src.rows, 1}; + size_t globalThreads[3] = {(size_t)src.cols, (size_t)src.rows, 1}; int srcElementSize = src.elemSize(); int src_step = src.step/srcElementSize; @@ -301,8 +301,8 @@ void ocl_tvl1flow::estimateDualVariables(oclMat &u1, oclMat &u2, oclMat &p11, oc size_t localThread[] = {32, 8, 1}; size_t globalThread[] = { - u1.cols, - u1.rows, + (size_t)u1.cols, + (size_t)u1.rows, 1 }; @@ -355,8 +355,8 @@ void ocl_tvl1flow::estimateU(oclMat &I1wx, oclMat &I1wy, oclMat &grad, size_t localThread[] = {32, 8, 1}; size_t globalThread[] = { - I1wx.cols, - I1wx.rows, + (size_t)I1wx.cols, + (size_t)I1wx.rows, 1 }; @@ -433,8 +433,8 @@ void ocl_tvl1flow::warpBackward(const oclMat &I0, const oclMat &I1, oclMat &I1x, size_t localThread[] = {32, 8, 1}; size_t globalThread[] = { - I0.cols, - I0.rows, + (size_t)I0.cols, + (size_t)I0.rows, 1 }; diff --git a/modules/ocl/test/test_api.cpp b/modules/ocl/test/test_api.cpp index 44dd7947a..c987d8bed 100644 --- a/modules/ocl/test/test_api.cpp +++ b/modules/ocl/test/test_api.cpp @@ -64,7 +64,7 @@ TEST(TestAPI, openCLExecuteKernelInterop) args.push_back( make_pair( sizeof(cl_mem), (void *) &gpuMat.data )); args.push_back( make_pair( sizeof(cl_mem), (void *) &gpuMatDst.data )); - size_t globalThreads[3] = { sz.width, 1, 1 }; + size_t globalThreads[3] = { (size_t)sz.width, 1, 1 }; cv::ocl::openCLExecuteKernelInterop( gpuMat.clCxt, program, diff --git a/modules/ocl/test/test_arithm.cpp b/modules/ocl/test/test_arithm.cpp index 29976b6e4..c2a69ee39 100644 --- a/modules/ocl/test/test_arithm.cpp +++ b/modules/ocl/test/test_arithm.cpp @@ -717,12 +717,12 @@ OCL_TEST_P(MinMax, MAT) { minVal = std::numeric_limits::max(); maxVal = -std::numeric_limits::max(); - for (int i = 0; i < src1_roi.rows; ++i) - for (int j = 0; j < src1_roi.cols; ++j) + for (int i2 = 0; i2 < src1_roi.rows; ++i2) + for (int j2 = 0; j2 < src1_roi.cols; ++j2) { - signed char val = src1_roi.at(i, j); - if (val < minVal) minVal = val; - if (val > maxVal) maxVal = val; + signed char oneVal = src1_roi.at(i2, j2); + if (oneVal < minVal) minVal = oneVal; + if (oneVal > maxVal) maxVal = oneVal; } } @@ -739,10 +739,10 @@ OCL_TEST_P(MinMax, MASK) enum { MAX_IDX = 0, MIN_IDX }; static const double minMaxGolds[2][7] = { - { std::numeric_limits::min(), std::numeric_limits::min(), std::numeric_limits::min(), - std::numeric_limits::min(), std::numeric_limits::min(), -std::numeric_limits::max(), -std::numeric_limits::max() }, - { std::numeric_limits::max(), std::numeric_limits::max(), std::numeric_limits::max(), - std::numeric_limits::max(), std::numeric_limits::max(), std::numeric_limits::max(), std::numeric_limits::max() }, + { (double)std::numeric_limits::min(), (double)std::numeric_limits::min(), (double)std::numeric_limits::min(), + (double)std::numeric_limits::min(), (double)std::numeric_limits::min(), (double)-std::numeric_limits::max(), (double)-std::numeric_limits::max() }, + { (double)std::numeric_limits::max(), (double)std::numeric_limits::max(), (double)std::numeric_limits::max(), + (double)std::numeric_limits::max(), (double)std::numeric_limits::max(), (double)std::numeric_limits::max(), (double)std::numeric_limits::max() }, }; for (int j = 0; j < LOOP_TIMES; j++) @@ -758,13 +758,13 @@ OCL_TEST_P(MinMax, MASK) { minVal = std::numeric_limits::max(); maxVal = -std::numeric_limits::max(); - for (int i = 0; i < src1_roi.rows; ++i) - for (int j = 0; j < src1_roi.cols; ++j) + for (int i2 = 0; i2 < src1_roi.rows; ++i2) + for (int j2 = 0; j2 < src1_roi.cols; ++j2) { - signed char val = src1_roi.at(i, j); - unsigned char m = mask_roi.at(i, j); - if (val < minVal && m) minVal = val; - if (val > maxVal && m) maxVal = val; + signed char oneVal = src1_roi.at(i2, j2); + unsigned char m = mask_roi.at(i2, j2); + if (oneVal < minVal && m) minVal = oneVal; + if (oneVal > maxVal && m) maxVal = oneVal; } } @@ -796,29 +796,29 @@ OCL_TEST_P(MinMaxLoc, MAT) double minVal, maxVal; cv::Point minLoc, maxLoc; - int depth = src1.depth(); + int oneDepth = src1.depth(); - if (depth != CV_8S) + if (oneDepth != CV_8S) cv::minMaxLoc(src1_roi, &minVal, &maxVal, &minLoc, &maxLoc); else { minVal = std::numeric_limits::max(); maxVal = -std::numeric_limits::max(); - for (int i = 0; i < src1_roi.rows; ++i) - for (int j = 0; j < src1_roi.cols; ++j) + for (int i2 = 0; i2 < src1_roi.rows; ++i2) + for (int j2 = 0; j2 < src1_roi.cols; ++j2) { - signed char val = src1_roi.at(i, j); - if (val < minVal) + signed char oneVal = src1_roi.at(i2, j2); + if (oneVal < minVal) { - minVal = val; - minLoc.x = j; - minLoc.y = i; + minVal = oneVal; + minLoc.x = j2; + minLoc.y = i2; } - if (val > maxVal) + if (oneVal > maxVal) { - maxVal = val; - maxLoc.x = j; - maxLoc.y = i; + maxVal = oneVal; + maxLoc.x = j2; + maxLoc.y = i2; } } } @@ -828,7 +828,7 @@ OCL_TEST_P(MinMaxLoc, MAT) cv::ocl::minMaxLoc(gsrc1_roi, &minVal_, &maxVal_, &minLoc_, &maxLoc_, cv::ocl::oclMat()); double error0 = 0., error1 = 0., minlocVal = 0., minlocVal_ = 0., maxlocVal = 0., maxlocVal_ = 0.; - if (depth == 0) + if (oneDepth == 0) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -837,7 +837,7 @@ OCL_TEST_P(MinMaxLoc, MAT) error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } - if (depth == 1) + if (oneDepth == 1) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -846,7 +846,7 @@ OCL_TEST_P(MinMaxLoc, MAT) error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } - if (depth == 2) + if (oneDepth == 2) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -855,7 +855,7 @@ OCL_TEST_P(MinMaxLoc, MAT) error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } - if (depth == 3) + if (oneDepth == 3) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -864,7 +864,7 @@ OCL_TEST_P(MinMaxLoc, MAT) error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } - if (depth == 4) + if (oneDepth == 4) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -873,7 +873,7 @@ OCL_TEST_P(MinMaxLoc, MAT) error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } - if (depth == 5) + if (oneDepth == 5) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -882,7 +882,7 @@ OCL_TEST_P(MinMaxLoc, MAT) error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } - if (depth == 6) + if (oneDepth == 6) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -909,29 +909,29 @@ OCL_TEST_P(MinMaxLoc, MASK) random_roi(); double minVal, maxVal; cv::Point minLoc, maxLoc; - int depth = src1.depth(); - if (depth != CV_8S) + int oneDepth = src1.depth(); + if (oneDepth != CV_8S) cv::minMaxLoc(src1_roi, &minVal, &maxVal, &minLoc, &maxLoc, mask_roi); else { minVal = std::numeric_limits::max(); maxVal = -std::numeric_limits::max(); - for (int i = 0; i < src1_roi.rows; ++i) - for (int j = 0; j < src1_roi.cols; ++j) + for (int i2 = 0; i2 < src1_roi.rows; ++i2) + for (int j2 = 0; j2 < src1_roi.cols; ++j2) { - signed char val = src1_roi.at(i, j); - unsigned char m = mask_roi.at(i , j); - if (val < minVal && m) + signed char oneVal = src1_roi.at(i2, j2); + unsigned char m = mask_roi.at(i2 , j2); + if (oneVal < minVal && m) { - minVal = val; - minLoc.x = j; - minLoc.y = i; + minVal = oneVal; + minLoc.x = j2; + minLoc.y = i2; } - if (val > maxVal && m) + if (oneVal > maxVal && m) { - maxVal = val; - maxLoc.x = j; - maxLoc.y = i; + maxVal = oneVal; + maxLoc.x = j2; + maxLoc.y = i2; } } } @@ -942,7 +942,7 @@ OCL_TEST_P(MinMaxLoc, MASK) double error0 = 0., error1 = 0., minlocVal = 0., minlocVal_ = 0., maxlocVal = 0., maxlocVal_ = 0.; if (minLoc_.x == -1 || minLoc_.y == -1 || maxLoc_.x == -1 || maxLoc_.y == -1) continue; - if (depth == 0) + if (oneDepth == 0) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -951,7 +951,7 @@ OCL_TEST_P(MinMaxLoc, MASK) error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } - if (depth == 1) + if (oneDepth == 1) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -960,7 +960,7 @@ OCL_TEST_P(MinMaxLoc, MASK) error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } - if (depth == 2) + if (oneDepth == 2) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -969,7 +969,7 @@ OCL_TEST_P(MinMaxLoc, MASK) error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } - if (depth == 3) + if (oneDepth == 3) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -978,7 +978,7 @@ OCL_TEST_P(MinMaxLoc, MASK) error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } - if (depth == 4) + if (oneDepth == 4) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -987,7 +987,7 @@ OCL_TEST_P(MinMaxLoc, MASK) error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } - if (depth == 5) + if (oneDepth == 5) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); @@ -996,7 +996,7 @@ OCL_TEST_P(MinMaxLoc, MASK) error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } - if (depth == 6) + if (oneDepth == 6) { minlocVal = src1_roi.at(minLoc); minlocVal_ = src1_roi.at(minLoc_); diff --git a/modules/ocl/test/test_canny.cpp b/modules/ocl/test/test_canny.cpp index 6bd7f26ad..b8c5e3cf0 100644 --- a/modules/ocl/test/test_canny.cpp +++ b/modules/ocl/test/test_canny.cpp @@ -77,10 +77,10 @@ OCL_TEST_P(Canny, Accuracy) cv::ocl::oclMat edges; cv::ocl::Canny(ocl_img, edges, low_thresh, high_thresh, apperture_size, useL2gradient); - cv::Mat edges_gold; - cv::Canny(img, edges_gold, low_thresh, high_thresh, apperture_size, useL2gradient); + cv::Mat local_edges_gold; + cv::Canny(img, local_edges_gold, low_thresh, high_thresh, apperture_size, useL2gradient); - EXPECT_MAT_SIMILAR(edges_gold, edges, 1e-2); + EXPECT_MAT_SIMILAR(local_edges_gold, edges, 1e-2); } INSTANTIATE_TEST_CASE_P(OCL_ImgProc, Canny, testing::Combine( diff --git a/modules/ocl/test/test_kmeans.cpp b/modules/ocl/test/test_kmeans.cpp index e1d0a1749..76b8f9824 100644 --- a/modules/ocl/test/test_kmeans.cpp +++ b/modules/ocl/test/test_kmeans.cpp @@ -133,10 +133,10 @@ OCL_TEST_P(Kmeans, Mat){ // verify lables with ground truth resutls int label = labels.at(row_idx); int header_label = dd_labels.at(row_idx); - for(int j = 0; (j < MHEIGHT/K)||(i == K-1 && j < MHEIGHT/K+MHEIGHT%K); j++) + for(int j2 = 0; (j2 < MHEIGHT/K)||(i == K-1 && j2 < MHEIGHT/K+MHEIGHT%K); j2++) { - ASSERT_NEAR(labels.at(row_idx+j), label, 0); - ASSERT_NEAR(dd_labels.at(row_idx+j), header_label, 0); + ASSERT_NEAR(labels.at(row_idx+j2), label, 0); + ASSERT_NEAR(dd_labels.at(row_idx+j2), header_label, 0); } // verify centers diff --git a/modules/ocl/test/test_ml.cpp b/modules/ocl/test/test_ml.cpp index 00f9fa941..2ce5a6e3d 100644 --- a/modules/ocl/test/test_ml.cpp +++ b/modules/ocl/test/test_ml.cpp @@ -142,12 +142,12 @@ PARAM_TEST_CASE(SVM_OCL, int, int, int) kernel_type = GET_PARAM(0); svm_type = GET_PARAM(1); K = GET_PARAM(2); - cv::Size size = cv::Size(MWIDTH, MHEIGHT); - src.create(size, CV_32FC1); - labels.create(1, size.height, CV_32SC1); + cv::Size sz = cv::Size(MWIDTH, MHEIGHT); + src.create(sz, CV_32FC1); + labels.create(1, sz.height, CV_32SC1); int row_idx = 0; - const int max_number = size.height / K - 1; - CV_Assert(K <= size.height); + const int max_number = sz.height / K - 1; + CV_Assert(K <= sz.height); for(int i = 0; i < K; i++ ) { Mat center_row_header = src.row(row_idx); @@ -159,7 +159,7 @@ PARAM_TEST_CASE(SVM_OCL, int, int, int) } labels.at(0, row_idx) = i; for(int j = 0; (j < max_number) || - (i == K - 1 && j < max_number + size.height % K); j ++) + (i == K - 1 && j < max_number + sz.height % K); j ++) { Mat cur_row_header = src.row(row_idx + 1 + j); center_row_header.copyTo(cur_row_header); diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index 9bf494fc6..04cea39d1 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -1,6 +1,6 @@ #if defined(_MSC_VER) && (_MSC_VER >= 1800) // eliminating duplicated round() declaration -#define HAVE_ROUND +#define HAVE_ROUND 1 #endif #include diff --git a/modules/superres/src/btv_l1_ocl.cpp b/modules/superres/src/btv_l1_ocl.cpp index 69564ef0d..006a1a78f 100644 --- a/modules/superres/src/btv_l1_ocl.cpp +++ b/modules/superres/src/btv_l1_ocl.cpp @@ -96,7 +96,7 @@ void btv_l1_device_ocl::buildMotionMaps(const oclMat& forwardMotionX, const oclM Context* clCxt = Context::getContext(); size_t local_thread[] = {32, 8, 1}; - size_t global_thread[] = {forwardMapX.cols, forwardMapX.rows, 1}; + size_t global_thread[] = {(size_t)forwardMapX.cols, (size_t)forwardMapX.rows, 1}; int forwardMotionX_step = (int)(forwardMotionX.step/forwardMotionX.elemSize()); int forwardMotionY_step = (int)(forwardMotionY.step/forwardMotionY.elemSize()); @@ -139,7 +139,7 @@ void btv_l1_device_ocl::upscale(const oclMat& src, oclMat& dst, int scale) Context* clCxt = Context::getContext(); size_t local_thread[] = {32, 8, 1}; - size_t global_thread[] = {src.cols, src.rows, 1}; + size_t global_thread[] = {(size_t)src.cols, (size_t)src.rows, 1}; int src_step = (int)(src.step/src.elemSize()); int dst_step = (int)(dst.step/dst.elemSize()); @@ -175,7 +175,7 @@ void btv_l1_device_ocl::diffSign(const oclMat& src1, const oclMat& src2, oclMat& int dst_step = (int)(dst_.step/dst_.elemSize()); size_t local_thread[] = {32, 8, 1}; - size_t global_thread[] = {src1_.cols, src1_.rows, 1}; + size_t global_thread[] = {(size_t)src1_.cols, (size_t)src1_.rows, 1}; String kernel_name = "diffSignKernel"; vector< pair > args; @@ -201,7 +201,7 @@ void btv_l1_device_ocl::calcBtvRegularization(const oclMat& src, oclMat& dst, in oclMat dst_ = dst.reshape(1); size_t local_thread[] = {32, 8, 1}; - size_t global_thread[] = {src.cols, src.rows, 1}; + size_t global_thread[] = {(size_t)src.cols, (size_t)src.rows, 1}; int src_step = (int)(src_.step/src_.elemSize()); int dst_step = (int)(dst_.step/dst_.elemSize()); diff --git a/modules/superres/src/input_array_utility.cpp b/modules/superres/src/input_array_utility.cpp index 10fc1c96e..2fece1f71 100644 --- a/modules/superres/src/input_array_utility.cpp +++ b/modules/superres/src/input_array_utility.cpp @@ -226,11 +226,11 @@ namespace static const double maxVals[] = { - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), - numeric_limits::max(), + (double)numeric_limits::max(), + (double)numeric_limits::max(), + (double)numeric_limits::max(), + (double)numeric_limits::max(), + (double)numeric_limits::max(), 1.0, 1.0, }; @@ -329,11 +329,11 @@ namespace static const double maxVals[] = { - std::numeric_limits::max(), - std::numeric_limits::max(), - std::numeric_limits::max(), - std::numeric_limits::max(), - std::numeric_limits::max(), + (double)std::numeric_limits::max(), + (double)std::numeric_limits::max(), + (double)std::numeric_limits::max(), + (double)std::numeric_limits::max(), + (double)std::numeric_limits::max(), 1.0, 1.0, }; diff --git a/modules/ts/include/opencv2/ts/gpu_perf.hpp b/modules/ts/include/opencv2/ts/gpu_perf.hpp index d74d7ea03..0054963ed 100644 --- a/modules/ts/include/opencv2/ts/gpu_perf.hpp +++ b/modules/ts/include/opencv2/ts/gpu_perf.hpp @@ -73,11 +73,6 @@ namespace perf #define DEF_PARAM_TEST(name, ...) typedef ::perf::TestBaseWithParam< std::tr1::tuple< __VA_ARGS__ > > name #define DEF_PARAM_TEST_1(name, param_type) typedef ::perf::TestBaseWithParam< param_type > name - DEF_PARAM_TEST_1(Sz, cv::Size); - typedef perf::Size_MatType Sz_Type; - DEF_PARAM_TEST(Sz_Depth, cv::Size, perf::MatDepth); - DEF_PARAM_TEST(Sz_Depth_Cn, cv::Size, perf::MatDepth, MatCn); - #define GPU_TYPICAL_MAT_SIZES testing::Values(perf::sz720p, perf::szSXGA, perf::sz1080p) #define FAIL_NO_CPU() FAIL() << "No such CPU implementation analogy"