mirror of
https://github.com/opencv/opencv.git
synced 2026-09-15 07:29:07 -05:00
ts: refactor OpenCV tests
- removed tr1 usage (dropped in C++17) - moved includes of vector/map/iostream/limits into ts.hpp - require opencv_test + anonymous namespace (added compile check) - fixed norm() usage (must be from cvtest::norm for checks) and other conflict functions - added missing license headers
This commit is contained in:
@@ -1027,8 +1027,8 @@ namespace cv { namespace cuda { namespace device
|
||||
vmin = fmin(vmin, b);
|
||||
|
||||
diff = v - vmin;
|
||||
s = diff / (float)(::fabs(v) + numeric_limits<float>::epsilon());
|
||||
diff = (float)(60. / (diff + numeric_limits<float>::epsilon()));
|
||||
s = diff / (float)(::fabs(v) + std::numeric_limits<float>::epsilon());
|
||||
diff = (float)(60. / (diff + std::numeric_limits<float>::epsilon()));
|
||||
|
||||
h = (v == r) * (g - b) * diff;
|
||||
h += (v != r && v == g) * ((b - r) * diff + 120.f);
|
||||
@@ -1261,7 +1261,7 @@ namespace cv { namespace cuda { namespace device
|
||||
diff = vmax - vmin;
|
||||
l = (vmax + vmin) * 0.5f;
|
||||
|
||||
if (diff > numeric_limits<float>::epsilon())
|
||||
if (diff > std::numeric_limits<float>::epsilon())
|
||||
{
|
||||
s = (l < 0.5f) * diff / (vmax + vmin);
|
||||
s += (l >= 0.5f) * diff / (2.0f - vmax - vmin);
|
||||
@@ -1802,7 +1802,7 @@ namespace cv { namespace cuda { namespace device
|
||||
float L = splineInterpolate(Y * (LAB_CBRT_TAB_SIZE / 1.5f), c_LabCbrtTab, LAB_CBRT_TAB_SIZE);
|
||||
L = 116.f * L - 16.f;
|
||||
|
||||
const float d = (4 * 13) / ::fmaxf(X + 15 * Y + 3 * Z, numeric_limits<float>::epsilon());
|
||||
const float d = (4 * 13) / ::fmaxf(X + 15 * Y + 3 * Z, std::numeric_limits<float>::epsilon());
|
||||
float u = L * (X * d - _un);
|
||||
float v = L * ((9 * 0.25f) * Y * d - _vn);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#include "opencv2/core/cuda.hpp"
|
||||
#include "opencv2/ts/cuda_perf.hpp"
|
||||
|
||||
using namespace std;
|
||||
namespace opencv_test { namespace {
|
||||
using namespace testing;
|
||||
using namespace perf;
|
||||
|
||||
@@ -193,4 +193,5 @@ PERF_TEST_P(Sz_2Depth, CUDA_GpuMat_ConvertTo,
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
#endif
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// Lut ////////////////////////
|
||||
@@ -352,7 +352,7 @@ enum
|
||||
|
||||
CV_ENUM(FlipType, FLIP_BOTH, FLIP_ROWS, FLIP_COLS)
|
||||
|
||||
typedef std::tr1::tuple<Size, MatType, FlipType> FlipParams;
|
||||
typedef tuple<Size, MatType, FlipType> FlipParams;
|
||||
typedef TestBaseWithParam<FlipParams> FlipFixture;
|
||||
|
||||
OCL_PERF_TEST_P(FlipFixture, Flip,
|
||||
@@ -570,7 +570,7 @@ OCL_PERF_TEST_P(BitwiseNotFixture, Bitwise_not,
|
||||
|
||||
CV_ENUM(CmpCode, CMP_LT, CMP_LE, CMP_EQ, CMP_NE, CMP_GE, CMP_GT)
|
||||
|
||||
typedef std::tr1::tuple<Size, MatType, CmpCode> CompareParams;
|
||||
typedef tuple<Size, MatType, CmpCode> CompareParams;
|
||||
typedef TestBaseWithParam<CompareParams> CompareFixture;
|
||||
|
||||
OCL_PERF_TEST_P(CompareFixture, Compare,
|
||||
@@ -773,7 +773,7 @@ OCL_PERF_TEST_P(MeanStdDevFixture, MeanStdDevWithMask,
|
||||
|
||||
CV_ENUM(NormType, NORM_INF, NORM_L1, NORM_L2)
|
||||
|
||||
typedef std::tr1::tuple<Size, MatType, NormType> NormParams;
|
||||
typedef tuple<Size, MatType, NormType> NormParams;
|
||||
typedef TestBaseWithParam<NormParams> NormFixture;
|
||||
|
||||
OCL_PERF_TEST_P(NormFixture, Norm1Arg,
|
||||
@@ -1176,6 +1176,6 @@ OCL_PERF_TEST_P(ReduceAccFixture, Reduce,
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
struct BufferPoolState
|
||||
@@ -127,6 +127,6 @@ OCL_PERF_TEST_P(BufferPoolFixture, BufferPool_UMatIntegral10, Bool())
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// Merge////////////////////////
|
||||
@@ -156,7 +156,7 @@ OCL_PERF_TEST_P(MixChannelsFixture, MixChannels,
|
||||
|
||||
///////////// InsertChannel ////////////////////////
|
||||
|
||||
typedef std::tr1::tuple<cv::Size, MatDepth> Size_MatDepth_t;
|
||||
typedef tuple<cv::Size, MatDepth> Size_MatDepth_t;
|
||||
typedef TestBaseWithParam<Size_MatDepth_t> Size_MatDepth;
|
||||
|
||||
typedef Size_MatDepth InsertChannelFixture;
|
||||
@@ -201,6 +201,6 @@ OCL_PERF_TEST_P(ExtractChannelFixture, ExtractChannel,
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// dft ////////////////////////
|
||||
@@ -113,6 +113,6 @@ OCL_PERF_TEST_P(MulSpectrumsFixture, MulSpectrums,
|
||||
SANITY_CHECK(dst, 1e-3);
|
||||
}
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// gemm ////////////////////////
|
||||
@@ -79,6 +79,6 @@ OCL_PERF_TEST_P(GemmFixture, Gemm, ::testing::Combine(
|
||||
SANITY_CHECK(dst, 0.01);
|
||||
}
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// SetTo ////////////////////////
|
||||
@@ -146,6 +146,6 @@ OCL_PERF_TEST_P(CopyToFixture, CopyToWithMaskUninit,
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
typedef TestBaseWithParam<std::tr1::tuple<cv::Size, bool> > UsageFlagsBoolFixture;
|
||||
typedef TestBaseWithParam<tuple<cv::Size, bool> > UsageFlagsBoolFixture;
|
||||
|
||||
OCL_PERF_TEST_P(UsageFlagsBoolFixture, UsageFlags_AllocHostMem, ::testing::Combine(OCL_TEST_SIZES, Bool()))
|
||||
{
|
||||
@@ -37,6 +37,6 @@ OCL_PERF_TEST_P(UsageFlagsBoolFixture, UsageFlags_AllocHostMem, ::testing::Combi
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
#define TYPICAL_MAT_SIZES_ABS TYPICAL_MAT_SIZES
|
||||
#define TYPICAL_MAT_TYPES_ABS CV_8SC1, CV_8SC4, CV_32SC1, CV_32FC1
|
||||
@@ -24,3 +22,5 @@ PERF_TEST_P(Size_MatType, abs, TYPICAL_MATS_ABS)
|
||||
|
||||
SANITY_CHECK(c);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
#define TYPICAL_MAT_TYPES_ADWEIGHTED CV_8UC1, CV_8UC4, CV_8SC1, CV_16UC1, CV_16SC1, CV_32SC1
|
||||
#define TYPICAL_MATS_ADWEIGHTED testing::Combine(testing::Values(szVGA, sz720p, sz1080p), testing::Values(TYPICAL_MAT_TYPES_ADWEIGHTED))
|
||||
@@ -34,3 +32,5 @@ PERF_TEST_P(Size_MatType, addWeighted, TYPICAL_MATS_ADWEIGHTED)
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
#define TYPICAL_MAT_SIZES_CORE_ARITHM ::szVGA, ::sz720p, ::sz1080p
|
||||
#define TYPICAL_MAT_SIZES_CORE_ARITHM szVGA, sz720p, sz1080p
|
||||
#define TYPICAL_MAT_TYPES_CORE_ARITHM CV_8UC1, CV_8SC1, CV_16SC1, CV_16SC2, CV_16SC3, CV_16SC4, CV_8UC4, CV_32SC1, CV_32FC1
|
||||
#define TYPICAL_MATS_CORE_ARITHM testing::Combine( testing::Values( TYPICAL_MAT_SIZES_CORE_ARITHM ), testing::Values( TYPICAL_MAT_TYPES_CORE_ARITHM ) )
|
||||
|
||||
@@ -20,7 +18,7 @@ PERF_TEST_P(Size_MatType, min, TYPICAL_MATS_CORE_ARITHM)
|
||||
|
||||
declare.in(a, b, WARMUP_RNG).out(c);
|
||||
|
||||
TEST_CYCLE() min(a, b, c);
|
||||
TEST_CYCLE() cv::min(a, b, c);
|
||||
|
||||
SANITY_CHECK(c);
|
||||
}
|
||||
@@ -35,7 +33,7 @@ PERF_TEST_P(Size_MatType, minScalar, TYPICAL_MATS_CORE_ARITHM)
|
||||
|
||||
declare.in(a, b, WARMUP_RNG).out(c);
|
||||
|
||||
TEST_CYCLE() min(a, b, c);
|
||||
TEST_CYCLE() cv::min(a, b, c);
|
||||
|
||||
SANITY_CHECK(c);
|
||||
}
|
||||
@@ -50,7 +48,7 @@ PERF_TEST_P(Size_MatType, max, TYPICAL_MATS_CORE_ARITHM)
|
||||
|
||||
declare.in(a, b, WARMUP_RNG).out(c);
|
||||
|
||||
TEST_CYCLE() max(a, b, c);
|
||||
TEST_CYCLE() cv::max(a, b, c);
|
||||
|
||||
SANITY_CHECK(c);
|
||||
}
|
||||
@@ -65,7 +63,7 @@ PERF_TEST_P(Size_MatType, maxScalar, TYPICAL_MATS_CORE_ARITHM)
|
||||
|
||||
declare.in(a, b, WARMUP_RNG).out(c);
|
||||
|
||||
TEST_CYCLE() max(a, b, c);
|
||||
TEST_CYCLE() cv::max(a, b, c);
|
||||
|
||||
SANITY_CHECK(c);
|
||||
}
|
||||
@@ -89,7 +87,7 @@ PERF_TEST_P(Size_MatType, absdiff, TYPICAL_MATS_CORE_ARITHM)
|
||||
eps = 1;
|
||||
}
|
||||
|
||||
TEST_CYCLE() absdiff(a, b, c);
|
||||
TEST_CYCLE() cv::absdiff(a, b, c);
|
||||
|
||||
SANITY_CHECK(c, eps);
|
||||
}
|
||||
@@ -113,7 +111,7 @@ PERF_TEST_P(Size_MatType, absdiffScalar, TYPICAL_MATS_CORE_ARITHM)
|
||||
eps = 1;
|
||||
}
|
||||
|
||||
TEST_CYCLE() absdiff(a, b, c);
|
||||
TEST_CYCLE() cv::absdiff(a, b, c);
|
||||
|
||||
SANITY_CHECK(c, eps);
|
||||
}
|
||||
@@ -138,7 +136,7 @@ PERF_TEST_P(Size_MatType, add, TYPICAL_MATS_CORE_ARITHM)
|
||||
eps = 1;
|
||||
}
|
||||
|
||||
TEST_CYCLE() add(a, b, c);
|
||||
TEST_CYCLE() cv::add(a, b, c);
|
||||
|
||||
SANITY_CHECK(c, eps);
|
||||
}
|
||||
@@ -162,7 +160,7 @@ PERF_TEST_P(Size_MatType, addScalar, TYPICAL_MATS_CORE_ARITHM)
|
||||
eps = 1;
|
||||
}
|
||||
|
||||
TEST_CYCLE() add(a, b, c);
|
||||
TEST_CYCLE() cv::add(a, b, c);
|
||||
|
||||
SANITY_CHECK(c, eps);
|
||||
}
|
||||
@@ -186,7 +184,7 @@ PERF_TEST_P(Size_MatType, subtract, TYPICAL_MATS_CORE_ARITHM)
|
||||
eps = 1;
|
||||
}
|
||||
|
||||
TEST_CYCLE() subtract(a, b, c);
|
||||
TEST_CYCLE() cv::subtract(a, b, c);
|
||||
|
||||
SANITY_CHECK(c, eps);
|
||||
}
|
||||
@@ -210,7 +208,7 @@ PERF_TEST_P(Size_MatType, subtractScalar, TYPICAL_MATS_CORE_ARITHM)
|
||||
eps = 1;
|
||||
}
|
||||
|
||||
TEST_CYCLE() subtract(a, b, c);
|
||||
TEST_CYCLE() cv::subtract(a, b, c);
|
||||
|
||||
SANITY_CHECK(c, eps);
|
||||
}
|
||||
@@ -229,7 +227,7 @@ PERF_TEST_P(Size_MatType, multiply, TYPICAL_MATS_CORE_ARITHM)
|
||||
b /= (2 << 16);
|
||||
}
|
||||
|
||||
TEST_CYCLE() multiply(a, b, c);
|
||||
TEST_CYCLE() cv::multiply(a, b, c);
|
||||
|
||||
SANITY_CHECK(c, 1e-8);
|
||||
}
|
||||
@@ -250,7 +248,7 @@ PERF_TEST_P(Size_MatType, multiplyScale, TYPICAL_MATS_CORE_ARITHM)
|
||||
b /= (2 << 16);
|
||||
}
|
||||
|
||||
TEST_CYCLE() multiply(a, b, c, scale);
|
||||
TEST_CYCLE() cv::multiply(a, b, c, scale);
|
||||
|
||||
SANITY_CHECK(c, 1e-8);
|
||||
}
|
||||
@@ -264,7 +262,7 @@ PERF_TEST_P(Size_MatType, divide, TYPICAL_MATS_CORE_ARITHM)
|
||||
|
||||
declare.in(a, b, WARMUP_RNG).out(c);
|
||||
|
||||
TEST_CYCLE() divide(a, b, c, scale);
|
||||
TEST_CYCLE() cv::divide(a, b, c, scale);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
@@ -278,7 +276,9 @@ PERF_TEST_P(Size_MatType, reciprocal, TYPICAL_MATS_CORE_ARITHM)
|
||||
|
||||
declare.in(b, WARMUP_RNG).out(c);
|
||||
|
||||
TEST_CYCLE() divide(scale, b, c);
|
||||
TEST_CYCLE() cv::divide(scale, b, c);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
#define TYPICAL_MAT_SIZES_BITW_ARITHM TYPICAL_MAT_SIZES
|
||||
#define TYPICAL_MAT_TYPES_BITW_ARITHM CV_8UC1, CV_8SC1, CV_8UC4, CV_32SC1, CV_32SC4
|
||||
@@ -73,3 +71,5 @@ PERF_TEST_P(Size_MatType, bitwise_xor, TYPICAL_MATS_BITW_ARITHM)
|
||||
|
||||
SANITY_CHECK(c);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
CV_ENUM(CmpType, CMP_EQ, CMP_GT, CMP_GE, CMP_LT, CMP_LE, CMP_NE)
|
||||
|
||||
typedef std::tr1::tuple<Size, MatType, CmpType> Size_MatType_CmpType_t;
|
||||
typedef tuple<Size, MatType, CmpType> Size_MatType_CmpType_t;
|
||||
typedef perf::TestBaseWithParam<Size_MatType_CmpType_t> Size_MatType_CmpType;
|
||||
|
||||
PERF_TEST_P( Size_MatType_CmpType, compare,
|
||||
@@ -57,3 +55,5 @@ PERF_TEST_P( Size_MatType_CmpType, compareScalar,
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
typedef std::tr1::tuple<Size, MatType, MatType, int, double> Size_DepthSrc_DepthDst_Channels_alpha_t;
|
||||
typedef tuple<Size, MatType, MatType, int, double> Size_DepthSrc_DepthDst_Channels_alpha_t;
|
||||
typedef perf::TestBaseWithParam<Size_DepthSrc_DepthDst_Channels_alpha_t> Size_DepthSrc_DepthDst_Channels_alpha;
|
||||
|
||||
PERF_TEST_P( Size_DepthSrc_DepthDst_Channels_alpha, convertTo,
|
||||
@@ -39,3 +37,5 @@ PERF_TEST_P( Size_DepthSrc_DepthDst_Channels_alpha, convertTo,
|
||||
eps = eps * std::max(1.0, fabs(alpha));
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
template <typename T>
|
||||
static void CvRoundMat(const cv::Mat & src, cv::Mat & dst)
|
||||
@@ -43,3 +41,5 @@ PERF_TEST_P(Size_MatType, CvRound_Float,
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
///////////////////////////////////////////////////////dft//////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -13,7 +11,7 @@ using std::tr1::get;
|
||||
CV_ENUM(FlagsType, 0, DFT_INVERSE, DFT_SCALE, DFT_COMPLEX_OUTPUT, DFT_ROWS, DFT_INVERSE|DFT_COMPLEX_OUTPUT)
|
||||
#define TEST_MATS_DFT testing::Combine(testing::Values(MAT_SIZES_DFT), testing::Values(MAT_TYPES_DFT), FlagsType::all(), testing::Values(true, false))
|
||||
|
||||
typedef std::tr1::tuple<Size, MatType, FlagsType, bool> Size_MatType_FlagsType_NzeroRows_t;
|
||||
typedef tuple<Size, MatType, FlagsType, bool> Size_MatType_FlagsType_NzeroRows_t;
|
||||
typedef perf::TestBaseWithParam<Size_MatType_FlagsType_NzeroRows_t> Size_MatType_FlagsType_NzeroRows;
|
||||
|
||||
PERF_TEST_P(Size_MatType_FlagsType_NzeroRows, dft, TEST_MATS_DFT)
|
||||
@@ -42,7 +40,7 @@ PERF_TEST_P(Size_MatType_FlagsType_NzeroRows, dft, TEST_MATS_DFT)
|
||||
|
||||
CV_ENUM(DCT_FlagsType, 0, DCT_INVERSE , DCT_ROWS, DCT_INVERSE|DCT_ROWS)
|
||||
|
||||
typedef std::tr1::tuple<Size, MatType, DCT_FlagsType> Size_MatType_Flag_t;
|
||||
typedef tuple<Size, MatType, DCT_FlagsType> Size_MatType_Flag_t;
|
||||
typedef perf::TestBaseWithParam<Size_MatType_Flag_t> Size_MatType_Flag;
|
||||
|
||||
PERF_TEST_P(Size_MatType_Flag, dct, testing::Combine(
|
||||
@@ -66,4 +64,6 @@ PERF_TEST_P(Size_MatType_Flag, dct, testing::Combine(
|
||||
TEST_CYCLE() dct(src, dst, flags);
|
||||
|
||||
SANITY_CHECK(dst, 1e-5, ERROR_RELATIVE);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
typedef tr1::tuple<MatType, int> MatType_Length_t;
|
||||
typedef tuple<MatType, int> MatType_Length_t;
|
||||
typedef TestBaseWithParam<MatType_Length_t> MatType_Length;
|
||||
|
||||
PERF_TEST_P( MatType_Length, dot,
|
||||
@@ -29,3 +27,5 @@ PERF_TEST_P( MatType_Length, dot,
|
||||
|
||||
SANITY_CHECK(product, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
#define TYPICAL_MAT_TYPES_INRANGE CV_8UC1, CV_8UC4, CV_8SC1, CV_16UC1, CV_16SC1, CV_32SC1, CV_32FC1, CV_32FC4
|
||||
#define TYPICAL_MATS_INRANGE testing::Combine(testing::Values(szVGA, sz720p, sz1080p), testing::Values(TYPICAL_MAT_TYPES_INRANGE))
|
||||
@@ -24,3 +22,5 @@ PERF_TEST_P(Size_MatType, inRange, TYPICAL_MATS_INRANGE)
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
typedef std::tr1::tuple<cv::Size, MatType, String> Size_MatType_Str_t;
|
||||
typedef tuple<cv::Size, MatType, String> Size_MatType_Str_t;
|
||||
typedef TestBaseWithParam<Size_MatType_Str_t> Size_Mat_StrType;
|
||||
|
||||
#define MAT_SIZES ::perf::sz1080p/*, ::perf::sz4320p*/
|
||||
@@ -84,3 +82,5 @@ PERF_TEST_P(Size_Mat_StrType, fs_base64,
|
||||
remove(file_name.c_str());
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test { namespace {
|
||||
using namespace perf;
|
||||
|
||||
typedef perf::TestBaseWithParam<Size> SizePrm;
|
||||
@@ -24,3 +23,5 @@ PERF_TEST_P( SizePrm, LUT,
|
||||
|
||||
SANITY_CHECK(dst, 0.1);
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
PERF_TEST_P(Size_MatType, Mat_Eye,
|
||||
testing::Combine(testing::Values(TYPICAL_MAT_SIZES),
|
||||
@@ -124,3 +122,5 @@ PERF_TEST_P(Size_MatType, Mat_Transform,
|
||||
|
||||
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
|
||||
namespace {
|
||||
@@ -158,3 +158,5 @@ INSTANTIATE_TEST_CASE_P(/*nothing*/ , KMeans,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
typedef std::tr1::tuple<Size, MatType, int> Size_SrcDepth_DstChannels_t;
|
||||
typedef tuple<Size, MatType, int> Size_SrcDepth_DstChannels_t;
|
||||
typedef perf::TestBaseWithParam<Size_SrcDepth_DstChannels_t> Size_SrcDepth_DstChannels;
|
||||
|
||||
PERF_TEST_P( Size_SrcDepth_DstChannels, merge,
|
||||
@@ -38,3 +36,5 @@ PERF_TEST_P( Size_SrcDepth_DstChannels, merge,
|
||||
double eps = srcDepth <= CV_32S ? 1e-12 : (FLT_EPSILON * maxValue);
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
PERF_TEST_P(Size_MatType, minMaxLoc, testing::Combine(
|
||||
testing::Values(TYPICAL_MAT_SIZES),
|
||||
@@ -33,3 +31,5 @@ PERF_TEST_P(Size_MatType, minMaxLoc, testing::Combine(
|
||||
SANITY_CHECK(minVal, 1e-12);
|
||||
SANITY_CHECK(maxVal, 1e-12);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
#define HAMMING_NORM_SIZES cv::Size(640, 480), cv::Size(1920, 1080)
|
||||
#define HAMMING_NORM_TYPES CV_8UC1
|
||||
|
||||
CV_FLAGS(NormType, NORM_HAMMING2, NORM_HAMMING, NORM_INF, NORM_L1, NORM_L2, NORM_TYPE_MASK, NORM_RELATIVE, NORM_MINMAX)
|
||||
typedef std::tr1::tuple<Size, MatType, NormType> Size_MatType_NormType_t;
|
||||
typedef tuple<Size, MatType, NormType> Size_MatType_NormType_t;
|
||||
typedef perf::TestBaseWithParam<Size_MatType_NormType_t> Size_MatType_NormType;
|
||||
|
||||
PERF_TEST_P(Size_MatType_NormType, norm,
|
||||
@@ -30,7 +28,7 @@ PERF_TEST_P(Size_MatType_NormType, norm,
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
|
||||
TEST_CYCLE() n = norm(src, normType);
|
||||
TEST_CYCLE() n = cv::norm(src, normType);
|
||||
|
||||
SANITY_CHECK(n, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
@@ -53,7 +51,7 @@ PERF_TEST_P(Size_MatType_NormType, norm_mask,
|
||||
|
||||
declare.in(src, WARMUP_RNG).in(mask);
|
||||
|
||||
TEST_CYCLE() n = norm(src, normType, mask);
|
||||
TEST_CYCLE() n = cv::norm(src, normType, mask);
|
||||
|
||||
SANITY_CHECK(n, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
@@ -76,7 +74,7 @@ PERF_TEST_P(Size_MatType_NormType, norm2,
|
||||
|
||||
declare.in(src1, src2, WARMUP_RNG);
|
||||
|
||||
TEST_CYCLE() n = norm(src1, src2, normType);
|
||||
TEST_CYCLE() n = cv::norm(src1, src2, normType);
|
||||
|
||||
SANITY_CHECK(n, 1e-5, ERROR_RELATIVE);
|
||||
}
|
||||
@@ -100,13 +98,13 @@ PERF_TEST_P(Size_MatType_NormType, norm2_mask,
|
||||
|
||||
declare.in(src1, src2, WARMUP_RNG).in(mask);
|
||||
|
||||
TEST_CYCLE() n = norm(src1, src2, normType, mask);
|
||||
TEST_CYCLE() n = cv::norm(src1, src2, normType, mask);
|
||||
|
||||
SANITY_CHECK(n, 1e-5, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
namespace {
|
||||
typedef std::tr1::tuple<NormType, MatType, Size> PerfHamming_t;
|
||||
typedef tuple<NormType, MatType, Size> PerfHamming_t;
|
||||
typedef perf::TestBaseWithParam<PerfHamming_t> PerfHamming;
|
||||
|
||||
PERF_TEST_P(PerfHamming, norm,
|
||||
@@ -126,7 +124,7 @@ PERF_TEST_P(PerfHamming, norm,
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
|
||||
TEST_CYCLE() n = norm(src, normType);
|
||||
TEST_CYCLE() n = cv::norm(src, normType);
|
||||
|
||||
(void)n;
|
||||
SANITY_CHECK_NOTHING();
|
||||
@@ -150,7 +148,7 @@ PERF_TEST_P(PerfHamming, norm2,
|
||||
|
||||
declare.in(src1, src2, WARMUP_RNG);
|
||||
|
||||
TEST_CYCLE() n = norm(src1, src2, normType);
|
||||
TEST_CYCLE() n = cv::norm(src1, src2, normType);
|
||||
|
||||
(void)n;
|
||||
SANITY_CHECK_NOTHING();
|
||||
@@ -180,7 +178,7 @@ PERF_TEST_P(Size_MatType_NormType, normalize,
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() normalize(src, dst, alpha, 0., normType);
|
||||
TEST_CYCLE() cv::normalize(src, dst, alpha, 0., normType);
|
||||
|
||||
SANITY_CHECK(dst, 1e-6);
|
||||
}
|
||||
@@ -208,7 +206,7 @@ PERF_TEST_P(Size_MatType_NormType, normalize_mask,
|
||||
declare.in(src, WARMUP_RNG).in(mask).out(dst);
|
||||
declare.time(100);
|
||||
|
||||
TEST_CYCLE() normalize(src, dst, alpha, 0., normType, -1, mask);
|
||||
TEST_CYCLE() cv::normalize(src, dst, alpha, 0., normType, -1, mask);
|
||||
|
||||
SANITY_CHECK(dst, 1e-6);
|
||||
}
|
||||
@@ -234,7 +232,7 @@ PERF_TEST_P(Size_MatType_NormType, normalize_32f,
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() normalize(src, dst, alpha, 0., normType, CV_32F);
|
||||
TEST_CYCLE() cv::normalize(src, dst, alpha, 0., normType, CV_32F);
|
||||
|
||||
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
@@ -250,7 +248,9 @@ PERF_TEST_P( Size_MatType, normalize_minmax, TYPICAL_MATS )
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
declare.time(30);
|
||||
|
||||
TEST_CYCLE() normalize(src, dst, 20., 100., NORM_MINMAX);
|
||||
TEST_CYCLE() cv::normalize(src, dst, 20., 100., NORM_MINMAX);
|
||||
|
||||
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,18 +1,9 @@
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
# if defined __clang__ || defined __APPLE__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||
# pragma GCC diagnostic ignored "-Wextra"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
#ifndef __OPENCV_PERF_PRECOMP_HPP__
|
||||
#define __OPENCV_PERF_PRECOMP_HPP__
|
||||
|
||||
#include "opencv2/ts.hpp"
|
||||
|
||||
#ifdef GTEST_CREATE_SHARED_LIBRARY
|
||||
#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
#include "perf_precomp.hpp"
|
||||
#include "opencv2/core/core_c.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
CV_ENUM(ROp, CV_REDUCE_SUM, CV_REDUCE_AVG, CV_REDUCE_MAX, CV_REDUCE_MIN)
|
||||
typedef std::tr1::tuple<Size, MatType, ROp> Size_MatType_ROp_t;
|
||||
typedef tuple<Size, MatType, ROp> Size_MatType_ROp_t;
|
||||
typedef perf::TestBaseWithParam<Size_MatType_ROp_t> Size_MatType_ROp;
|
||||
|
||||
|
||||
@@ -66,3 +64,5 @@ PERF_TEST_P(Size_MatType_ROp, reduceC,
|
||||
|
||||
SANITY_CHECK(vec, 1);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
|
||||
using std::tr1::tuple;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
#define TYPICAL_MAT_SIZES_SORT TYPICAL_MAT_SIZES
|
||||
#define TYPICAL_MAT_TYPES_SORT CV_8UC1, CV_16UC1, CV_32FC1
|
||||
#define SORT_TYPES SORT_EVERY_ROW | SORT_ASCENDING, SORT_EVERY_ROW | SORT_DESCENDING
|
||||
@@ -50,3 +46,5 @@ PERF_TEST_P(sortIdxFixture, sorIdx, TYPICAL_MATS_SORT)
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
typedef std::tr1::tuple<Size, MatType, int> Size_Depth_Channels_t;
|
||||
typedef tuple<Size, MatType, int> Size_Depth_Channels_t;
|
||||
typedef perf::TestBaseWithParam<Size_Depth_Channels_t> Size_Depth_Channels;
|
||||
|
||||
PERF_TEST_P( Size_Depth_Channels, split,
|
||||
@@ -35,3 +33,5 @@ PERF_TEST_P( Size_Depth_Channels, split,
|
||||
SANITY_CHECK(mv, 1e-12);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
PERF_TEST_P(Size_MatType, sum, TYPICAL_MATS)
|
||||
{
|
||||
@@ -102,3 +100,5 @@ PERF_TEST_P(Size_MatType, countNonZero, testing::Combine( testing::Values( TYPIC
|
||||
|
||||
SANITY_CHECK(cnt);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -5,13 +5,10 @@
|
||||
#include "perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace ::perf;
|
||||
namespace opencv_test
|
||||
{
|
||||
using namespace perf;
|
||||
using namespace ::cvtest::ocl;
|
||||
using namespace ::testing;
|
||||
using std::tr1::tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
|
||||
struct OpenCLState
|
||||
@@ -63,3 +60,5 @@ OCL_PERF_TEST_P(UMatTest, CustomPtr, Combine(Values(sz1080p, sz2160p), Bool(), :
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -42,11 +42,9 @@
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
//////////////////////////////// LUT /////////////////////////////////////////////////
|
||||
@@ -138,8 +136,8 @@ PARAM_TEST_CASE(ArithmTestBase, MatDepth, Channels, bool)
|
||||
{
|
||||
const int type = CV_MAKE_TYPE(depth, cn);
|
||||
|
||||
double minV = getMinVal(type);
|
||||
double maxV = getMaxVal(type);
|
||||
double minV = cvtest::getMinVal(type);
|
||||
double maxV = cvtest::getMaxVal(type);
|
||||
|
||||
Size roiSize = randomSize(1, MAX_VALUE);
|
||||
Border src1Border = randomBorder(0, use_roi ? MAX_VALUE : 0);
|
||||
@@ -1964,6 +1962,6 @@ OCL_TEST(Normalize, DISABLED_regression_5876_inplace_change_type)
|
||||
EXPECT_EQ(0, cvtest::norm(um, uresult, NORM_INF));
|
||||
}
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
//////////////////////////////////////// Merge ///////////////////////////////////////////////
|
||||
@@ -464,6 +464,6 @@ OCL_INSTANTIATE_TEST_CASE_P(Channels, MixChannels, Combine(OCL_ALL_DEPTHS, Bool(
|
||||
OCL_INSTANTIATE_TEST_CASE_P(Channels, InsertChannel, Combine(OCL_ALL_DEPTHS, OCL_ALL_CHANNELS, Bool()));
|
||||
OCL_INSTANTIATE_TEST_CASE_P(Channels, ExtractChannel, Combine(OCL_ALL_DEPTHS, OCL_ALL_CHANNELS, Bool()));
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
@@ -56,7 +56,7 @@ enum OCL_FFT_TYPE
|
||||
C2C = 3
|
||||
};
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
@@ -185,6 +185,6 @@ OCL_INSTANTIATE_TEST_CASE_P(Core, Dft, Combine(Values(cv::Size(45, 72), cv::Size
|
||||
)
|
||||
);
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
@@ -145,6 +145,6 @@ OCL_INSTANTIATE_TEST_CASE_P(Core, Gemm, ::testing::Combine(
|
||||
testing::Values(CV_32FC1, CV_32FC2, CV_64FC1, CV_64FC2),
|
||||
Bool(), Bool(), Bool(), Bool()));
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
TEST(Image2D, createAliasEmptyUMat)
|
||||
@@ -91,6 +91,6 @@ TEST(Image2D, turnOffOpenCL)
|
||||
std::cout << "OpenCL runtime not found. Test skipped." << std::endl;
|
||||
}
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
//////////////////////////////// UMat Expressions /////////////////////////////////////////////////
|
||||
@@ -80,6 +80,6 @@ OCL_TEST_P(UMatExpr, Ones)
|
||||
|
||||
OCL_INSTANTIATE_TEST_CASE_P(MatrixOperation, UMatExpr, Combine(OCL_ALL_DEPTHS, OCL_ALL_CHANNELS));
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
////////////////////////////////converto/////////////////////////////////////////////////
|
||||
@@ -219,6 +219,6 @@ OCL_INSTANTIATE_TEST_CASE_P(MatrixOperation, CopyTo, Combine(
|
||||
OCL_INSTANTIATE_TEST_CASE_P(MatrixOperation, SetTo, Combine(
|
||||
OCL_ALL_DEPTHS, OCL_ALL_CHANNELS, Bool(), Bool()));
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "../test_precomp.hpp"
|
||||
|
||||
#include <opencv2/core/ocl.hpp>
|
||||
#include <fstream>
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#include "test_precomp.hpp"
|
||||
#include <cmath>
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
namespace cvtest
|
||||
{
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
const int ARITHM_NTESTS = 1000;
|
||||
const int ARITHM_RNG_SEED = -1;
|
||||
@@ -31,7 +29,7 @@ struct BaseElemWiseOp
|
||||
|
||||
virtual void getRandomSize(RNG& rng, vector<int>& size)
|
||||
{
|
||||
cvtest::randomSize(rng, 2, ARITHM_MAX_NDIMS, cvtest::ARITHM_MAX_SIZE_LOG, size);
|
||||
cvtest::randomSize(rng, 2, ARITHM_MAX_NDIMS, ARITHM_MAX_SIZE_LOG, size);
|
||||
}
|
||||
|
||||
virtual int getRandomType(RNG& rng)
|
||||
@@ -119,9 +117,9 @@ struct AddOp : public BaseAddOp
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat& mask)
|
||||
{
|
||||
if( mask.empty() )
|
||||
add(src[0], src[1], dst);
|
||||
cv::add(src[0], src[1], dst);
|
||||
else
|
||||
add(src[0], src[1], dst, mask);
|
||||
cv::add(src[0], src[1], dst, mask);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -132,9 +130,9 @@ struct SubOp : public BaseAddOp
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat& mask)
|
||||
{
|
||||
if( mask.empty() )
|
||||
subtract(src[0], src[1], dst);
|
||||
cv::subtract(src[0], src[1], dst);
|
||||
else
|
||||
subtract(src[0], src[1], dst, mask);
|
||||
cv::subtract(src[0], src[1], dst, mask);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -145,9 +143,9 @@ struct AddSOp : public BaseAddOp
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat& mask)
|
||||
{
|
||||
if( mask.empty() )
|
||||
add(src[0], gamma, dst);
|
||||
cv::add(src[0], gamma, dst);
|
||||
else
|
||||
add(src[0], gamma, dst, mask);
|
||||
cv::add(src[0], gamma, dst, mask);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -158,9 +156,9 @@ struct SubRSOp : public BaseAddOp
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat& mask)
|
||||
{
|
||||
if( mask.empty() )
|
||||
subtract(gamma, src[0], dst);
|
||||
cv::subtract(gamma, src[0], dst);
|
||||
else
|
||||
subtract(gamma, src[0], dst, mask);
|
||||
cv::subtract(gamma, src[0], dst, mask);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -170,7 +168,7 @@ struct ScaleAddOp : public BaseAddOp
|
||||
ScaleAddOp() : BaseAddOp(2, FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {}
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
scaleAdd(src[0], alpha, src[1], dst);
|
||||
cv::scaleAdd(src[0], alpha, src[1], dst);
|
||||
}
|
||||
double getMaxErr(int depth)
|
||||
{
|
||||
@@ -184,7 +182,7 @@ struct AddWeightedOp : public BaseAddOp
|
||||
AddWeightedOp() : BaseAddOp(2, REAL_GAMMA, 1, 1, Scalar::all(0)) {}
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
addWeighted(src[0], alpha, src[1], beta, gamma[0], dst);
|
||||
cv::addWeighted(src[0], alpha, src[1], beta, gamma[0], dst);
|
||||
}
|
||||
double getMaxErr(int depth)
|
||||
{
|
||||
@@ -282,11 +280,11 @@ struct LogicOp : public BaseElemWiseOp
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat& mask)
|
||||
{
|
||||
if( opcode == '&' )
|
||||
bitwise_and(src[0], src[1], dst, mask);
|
||||
cv::bitwise_and(src[0], src[1], dst, mask);
|
||||
else if( opcode == '|' )
|
||||
bitwise_or(src[0], src[1], dst, mask);
|
||||
cv::bitwise_or(src[0], src[1], dst, mask);
|
||||
else
|
||||
bitwise_xor(src[0], src[1], dst, mask);
|
||||
cv::bitwise_xor(src[0], src[1], dst, mask);
|
||||
}
|
||||
void refop(const vector<Mat>& src, Mat& dst, const Mat& mask)
|
||||
{
|
||||
@@ -313,13 +311,13 @@ struct LogicSOp : public BaseElemWiseOp
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat& mask)
|
||||
{
|
||||
if( opcode == '&' )
|
||||
bitwise_and(src[0], gamma, dst, mask);
|
||||
cv::bitwise_and(src[0], gamma, dst, mask);
|
||||
else if( opcode == '|' )
|
||||
bitwise_or(src[0], gamma, dst, mask);
|
||||
cv::bitwise_or(src[0], gamma, dst, mask);
|
||||
else if( opcode == '^' )
|
||||
bitwise_xor(src[0], gamma, dst, mask);
|
||||
cv::bitwise_xor(src[0], gamma, dst, mask);
|
||||
else
|
||||
bitwise_not(src[0], dst);
|
||||
cv::bitwise_not(src[0], dst);
|
||||
}
|
||||
void refop(const vector<Mat>& src, Mat& dst, const Mat& mask)
|
||||
{
|
||||
@@ -547,6 +545,7 @@ template<typename _Tp> static void inRange_(const _Tp* src, const _Tp* a, const
|
||||
}
|
||||
}
|
||||
|
||||
namespace reference {
|
||||
|
||||
static void inRange(const Mat& src, const Mat& lb, const Mat& rb, Mat& dst)
|
||||
{
|
||||
@@ -597,7 +596,6 @@ static void inRange(const Mat& src, const Mat& lb, const Mat& rb, Mat& dst)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& dst)
|
||||
{
|
||||
dst.create( src.dims, &src.size[0], CV_8U );
|
||||
@@ -647,6 +645,8 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
CVTEST_GUARD_SYMBOL(inRange);
|
||||
|
||||
struct InRangeSOp : public BaseElemWiseOp
|
||||
{
|
||||
@@ -657,7 +657,7 @@ struct InRangeSOp : public BaseElemWiseOp
|
||||
}
|
||||
void refop(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
cvtest::inRangeS(src[0], gamma, gamma1, dst);
|
||||
reference::inRangeS(src[0], gamma, gamma1, dst);
|
||||
}
|
||||
double getMaxErr(int)
|
||||
{
|
||||
@@ -695,7 +695,7 @@ struct InRangeOp : public BaseElemWiseOp
|
||||
cvtest::min(src[1], src[2], lb);
|
||||
cvtest::max(src[1], src[2], rb);
|
||||
|
||||
cvtest::inRange(src[0], lb, rb, dst);
|
||||
reference::inRange(src[0], lb, rb, dst);
|
||||
}
|
||||
double getMaxErr(int)
|
||||
{
|
||||
@@ -827,6 +827,7 @@ struct ConvertScaleAbsOp : public BaseElemWiseOp
|
||||
}
|
||||
};
|
||||
|
||||
namespace reference {
|
||||
|
||||
static void flip(const Mat& src, Mat& dst, int flipcode)
|
||||
{
|
||||
@@ -867,13 +868,14 @@ static void setIdentity(Mat& dst, const Scalar& s)
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
struct FlipOp : public BaseElemWiseOp
|
||||
{
|
||||
FlipOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) { flipcode = 0; }
|
||||
void getRandomSize(RNG& rng, vector<int>& size)
|
||||
{
|
||||
cvtest::randomSize(rng, 2, 2, cvtest::ARITHM_MAX_SIZE_LOG, size);
|
||||
cvtest::randomSize(rng, 2, 2, ARITHM_MAX_SIZE_LOG, size);
|
||||
}
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
@@ -881,7 +883,7 @@ struct FlipOp : public BaseElemWiseOp
|
||||
}
|
||||
void refop(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
cvtest::flip(src[0], dst, flipcode);
|
||||
reference::flip(src[0], dst, flipcode);
|
||||
}
|
||||
void generateScalars(int, RNG& rng)
|
||||
{
|
||||
@@ -899,7 +901,7 @@ struct TransposeOp : public BaseElemWiseOp
|
||||
TransposeOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {}
|
||||
void getRandomSize(RNG& rng, vector<int>& size)
|
||||
{
|
||||
cvtest::randomSize(rng, 2, 2, cvtest::ARITHM_MAX_SIZE_LOG, size);
|
||||
cvtest::randomSize(rng, 2, 2, ARITHM_MAX_SIZE_LOG, size);
|
||||
}
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
@@ -920,7 +922,7 @@ struct SetIdentityOp : public BaseElemWiseOp
|
||||
SetIdentityOp() : BaseElemWiseOp(0, FIX_ALPHA+FIX_BETA, 1, 1, Scalar::all(0)) {}
|
||||
void getRandomSize(RNG& rng, vector<int>& size)
|
||||
{
|
||||
cvtest::randomSize(rng, 2, 2, cvtest::ARITHM_MAX_SIZE_LOG, size);
|
||||
cvtest::randomSize(rng, 2, 2, ARITHM_MAX_SIZE_LOG, size);
|
||||
}
|
||||
void op(const vector<Mat>&, Mat& dst, const Mat&)
|
||||
{
|
||||
@@ -928,7 +930,7 @@ struct SetIdentityOp : public BaseElemWiseOp
|
||||
}
|
||||
void refop(const vector<Mat>&, Mat& dst, const Mat&)
|
||||
{
|
||||
cvtest::setIdentity(dst, gamma);
|
||||
reference::setIdentity(dst, gamma);
|
||||
}
|
||||
double getMaxErr(int)
|
||||
{
|
||||
@@ -953,7 +955,7 @@ struct SetZeroOp : public BaseElemWiseOp
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
namespace reference {
|
||||
static void exp(const Mat& src, Mat& dst)
|
||||
{
|
||||
dst.create( src.dims, &src.size[0], src.type() );
|
||||
@@ -1012,6 +1014,8 @@ static void log(const Mat& src, Mat& dst)
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
struct ExpOp : public BaseElemWiseOp
|
||||
{
|
||||
ExpOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {}
|
||||
@@ -1030,7 +1034,7 @@ struct ExpOp : public BaseElemWiseOp
|
||||
}
|
||||
void refop(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
cvtest::exp(src[0], dst);
|
||||
reference::exp(src[0], dst);
|
||||
}
|
||||
double getMaxErr(int depth)
|
||||
{
|
||||
@@ -1054,14 +1058,14 @@ struct LogOp : public BaseElemWiseOp
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
Mat temp;
|
||||
cvtest::exp(src[0], temp);
|
||||
reference::exp(src[0], temp);
|
||||
cv::log(temp, dst);
|
||||
}
|
||||
void refop(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
Mat temp;
|
||||
cvtest::exp(src[0], temp);
|
||||
cvtest::log(temp, dst);
|
||||
reference::exp(src[0], temp);
|
||||
reference::log(temp, dst);
|
||||
}
|
||||
double getMaxErr(int depth)
|
||||
{
|
||||
@@ -1070,6 +1074,7 @@ struct LogOp : public BaseElemWiseOp
|
||||
};
|
||||
|
||||
|
||||
namespace reference {
|
||||
static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bool angleInDegrees)
|
||||
{
|
||||
CV_Assert( (mx.type() == CV_32F || mx.type() == CV_64F) &&
|
||||
@@ -1120,6 +1125,7 @@ static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bo
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
struct CartToPolarToCartOp : public BaseElemWiseOp
|
||||
{
|
||||
@@ -1147,7 +1153,7 @@ struct CartToPolarToCartOp : public BaseElemWiseOp
|
||||
void refop(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
Mat mag, angle;
|
||||
cvtest::cartToPolar(src[0], src[1], mag, angle, angleInDegrees);
|
||||
reference::cartToPolar(src[0], src[1], mag, angle, angleInDegrees);
|
||||
Mat msrc[] = {mag, angle, src[0], src[1]};
|
||||
int pairs[] = {0, 0, 1, 1, 2, 2, 3, 3};
|
||||
dst.create(src[0].dims, src[0].size, CV_MAKETYPE(src[0].depth(), 4));
|
||||
@@ -1382,9 +1388,7 @@ struct MinMaxLocOp : public BaseElemWiseOp
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
typedef Ptr<cvtest::BaseElemWiseOp> ElemWiseOpPtr;
|
||||
typedef Ptr<BaseElemWiseOp> ElemWiseOpPtr;
|
||||
class ElemWiseTest : public ::testing::TestWithParam<ElemWiseOpPtr> {};
|
||||
|
||||
TEST_P(ElemWiseTest, accuracy)
|
||||
@@ -1392,15 +1396,15 @@ TEST_P(ElemWiseTest, accuracy)
|
||||
ElemWiseOpPtr op = GetParam();
|
||||
|
||||
int testIdx = 0;
|
||||
RNG rng((uint64)cvtest::ARITHM_RNG_SEED);
|
||||
for( testIdx = 0; testIdx < cvtest::ARITHM_NTESTS; testIdx++ )
|
||||
RNG rng((uint64)ARITHM_RNG_SEED);
|
||||
for( testIdx = 0; testIdx < ARITHM_NTESTS; testIdx++ )
|
||||
{
|
||||
vector<int> size;
|
||||
op->getRandomSize(rng, size);
|
||||
int type = op->getRandomType(rng);
|
||||
int depth = CV_MAT_DEPTH(type);
|
||||
bool haveMask = ((op->flags & cvtest::BaseElemWiseOp::SUPPORT_MASK) != 0
|
||||
|| (op->flags & cvtest::BaseElemWiseOp::SUPPORT_MULTICHANNELMASK) != 0) && rng.uniform(0, 4) == 0;
|
||||
bool haveMask = ((op->flags & BaseElemWiseOp::SUPPORT_MASK) != 0
|
||||
|| (op->flags & BaseElemWiseOp::SUPPORT_MULTICHANNELMASK) != 0) && rng.uniform(0, 4) == 0;
|
||||
|
||||
double minval=0, maxval=0;
|
||||
op->getValueRange(depth, minval, maxval);
|
||||
@@ -1410,13 +1414,13 @@ TEST_P(ElemWiseTest, accuracy)
|
||||
src[i] = cvtest::randomMat(rng, size, type, minval, maxval, true);
|
||||
Mat dst0, dst, mask;
|
||||
if( haveMask ) {
|
||||
bool multiChannelMask = (op->flags & cvtest::BaseElemWiseOp::SUPPORT_MULTICHANNELMASK) != 0
|
||||
bool multiChannelMask = (op->flags & BaseElemWiseOp::SUPPORT_MULTICHANNELMASK) != 0
|
||||
&& rng.uniform(0, 2) == 0;
|
||||
int masktype = CV_8UC(multiChannelMask ? CV_MAT_CN(type) : 1);
|
||||
mask = cvtest::randomMat(rng, size, masktype, 0, 2, true);
|
||||
}
|
||||
|
||||
if( (haveMask || ninputs == 0) && !(op->flags & cvtest::BaseElemWiseOp::SCALAR_OUTPUT))
|
||||
if( (haveMask || ninputs == 0) && !(op->flags & BaseElemWiseOp::SCALAR_OUTPUT))
|
||||
{
|
||||
dst0 = cvtest::randomMat(rng, size, type, minval, maxval, false);
|
||||
dst = cvtest::randomMat(rng, size, type, minval, maxval, true);
|
||||
@@ -1434,61 +1438,61 @@ TEST_P(ElemWiseTest, accuracy)
|
||||
}
|
||||
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core_Copy, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::CopyOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Set, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::SetOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_SetZero, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::SetZeroOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_ConvertScale, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::ConvertScaleOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_ConvertScaleFp16, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::ConvertScaleFp16Op)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_ConvertScaleAbs, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::ConvertScaleAbsOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Copy, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new CopyOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Set, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new SetOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_SetZero, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new SetZeroOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_ConvertScale, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new ConvertScaleOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_ConvertScaleFp16, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new ConvertScaleFp16Op)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_ConvertScaleAbs, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new ConvertScaleAbsOp)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core_Add, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::AddOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Sub, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::SubOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_AddS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::AddSOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_SubRS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::SubRSOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_ScaleAdd, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::ScaleAddOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_AddWeighted, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::AddWeightedOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_AbsDiff, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::AbsDiffOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Add, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new AddOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Sub, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new SubOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_AddS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new AddSOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_SubRS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new SubRSOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_ScaleAdd, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new ScaleAddOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_AddWeighted, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new AddWeightedOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_AbsDiff, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new AbsDiffOp)));
|
||||
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core_AbsDiffS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::AbsDiffSOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_AbsDiffS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new AbsDiffSOp)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core_And, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::LogicOp('&'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_AndS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::LogicSOp('&'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Or, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::LogicOp('|'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_OrS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::LogicSOp('|'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Xor, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::LogicOp('^'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_XorS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::LogicSOp('^'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Not, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::LogicSOp('~'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_And, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new LogicOp('&'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_AndS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new LogicSOp('&'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Or, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new LogicOp('|'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_OrS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new LogicSOp('|'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Xor, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new LogicOp('^'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_XorS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new LogicSOp('^'))));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Not, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new LogicSOp('~'))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core_Max, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::MaxOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_MaxS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::MaxSOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Min, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::MinOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_MinS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::MinSOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Max, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new MaxOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_MaxS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new MaxSOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Min, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new MinOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_MinS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new MinSOp)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core_Mul, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::MulOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Div, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::DivOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Recip, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::RecipOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Mul, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new MulOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Div, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new DivOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Recip, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new RecipOp)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core_Cmp, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::CmpOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_CmpS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::CmpSOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Cmp, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new CmpOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_CmpS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new CmpSOp)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core_InRangeS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::InRangeSOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_InRange, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::InRangeOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_InRangeS, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new InRangeSOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_InRange, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new InRangeOp)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core_Flip, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::FlipOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Transpose, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::TransposeOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_SetIdentity, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::SetIdentityOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Flip, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new FlipOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Transpose, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new TransposeOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_SetIdentity, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new SetIdentityOp)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core_Exp, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::ExpOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Log, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::LogOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Exp, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new ExpOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Log, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new LogOp)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core_CountNonZero, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::CountNonZeroOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Mean, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::MeanOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_MeanStdDev, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::MeanStdDevOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Sum, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::SumOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Norm, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::NormOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_MinMaxLoc, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::MinMaxLocOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_CartToPolarToCart, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::CartToPolarToCartOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_CountNonZero, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new CountNonZeroOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Mean, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new MeanOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_MeanStdDev, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new MeanStdDevOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Sum, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new SumOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_Norm, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new NormOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_MinMaxLoc, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new MinMaxLocOp)));
|
||||
INSTANTIATE_TEST_CASE_P(Core_CartToPolarToCart, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new CartToPolarToCartOp)));
|
||||
|
||||
|
||||
TEST(Core_ArithmMask, uninitialized)
|
||||
@@ -1528,34 +1532,34 @@ TEST(Core_ArithmMask, uninitialized)
|
||||
a.convertTo(a1, depth1);
|
||||
b.convertTo(b1, depth1);
|
||||
// invert the mask
|
||||
compare(mask, 0, mask1, CMP_EQ);
|
||||
cv::compare(mask, 0, mask1, CMP_EQ);
|
||||
a1.setTo(0, mask1);
|
||||
b1.setTo(0, mask1);
|
||||
|
||||
if( op == 0 )
|
||||
{
|
||||
add(a, b, c, mask);
|
||||
add(a1, b1, d);
|
||||
cv::add(a, b, c, mask);
|
||||
cv::add(a1, b1, d);
|
||||
}
|
||||
else if( op == 1 )
|
||||
{
|
||||
subtract(a, b, c, mask);
|
||||
subtract(a1, b1, d);
|
||||
cv::subtract(a, b, c, mask);
|
||||
cv::subtract(a1, b1, d);
|
||||
}
|
||||
else if( op == 2 )
|
||||
{
|
||||
bitwise_and(a, b, c, mask);
|
||||
bitwise_and(a1, b1, d);
|
||||
cv::bitwise_and(a, b, c, mask);
|
||||
cv::bitwise_and(a1, b1, d);
|
||||
}
|
||||
else if( op == 3 )
|
||||
{
|
||||
bitwise_or(a, b, c, mask);
|
||||
bitwise_or(a1, b1, d);
|
||||
cv::bitwise_or(a, b, c, mask);
|
||||
cv::bitwise_or(a1, b1, d);
|
||||
}
|
||||
else if( op == 4 )
|
||||
{
|
||||
bitwise_xor(a, b, c, mask);
|
||||
bitwise_xor(a1, b1, d);
|
||||
cv::bitwise_xor(a, b, c, mask);
|
||||
cv::bitwise_xor(a1, b1, d);
|
||||
}
|
||||
Mat d1;
|
||||
d.convertTo(d1, depth);
|
||||
@@ -1630,7 +1634,7 @@ TEST_P(Mul1, One)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Arithm, Mul1, testing::Values(Size(2, 2), Size(1, 1)));
|
||||
|
||||
class SubtractOutputMatNotEmpty : public testing::TestWithParam< std::tr1::tuple<cv::Size, perf::MatType, perf::MatDepth, bool> >
|
||||
class SubtractOutputMatNotEmpty : public testing::TestWithParam< tuple<cv::Size, perf::MatType, perf::MatDepth, bool> >
|
||||
{
|
||||
public:
|
||||
cv::Size size;
|
||||
@@ -1640,10 +1644,10 @@ public:
|
||||
|
||||
void SetUp()
|
||||
{
|
||||
size = std::tr1::get<0>(GetParam());
|
||||
src_type = std::tr1::get<1>(GetParam());
|
||||
dst_depth = std::tr1::get<2>(GetParam());
|
||||
fixed = std::tr1::get<3>(GetParam());
|
||||
size = get<0>(GetParam());
|
||||
src_type = get<1>(GetParam());
|
||||
dst_depth = get<2>(GetParam());
|
||||
fixed = get<3>(GetParam());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1864,13 +1868,13 @@ TEST(Core_BoolVector, support)
|
||||
nz += (int)test[i];
|
||||
}
|
||||
ASSERT_EQ( nz, countNonZero(test) );
|
||||
ASSERT_FLOAT_EQ((float)nz/n, (float)(mean(test)[0]));
|
||||
ASSERT_FLOAT_EQ((float)nz/n, (float)(cv::mean(test)[0]));
|
||||
}
|
||||
|
||||
TEST(MinMaxLoc, Mat_UcharMax_Without_Loc)
|
||||
{
|
||||
Mat_<uchar> mat(50, 50);
|
||||
uchar iMaxVal = numeric_limits<uchar>::max();
|
||||
uchar iMaxVal = std::numeric_limits<uchar>::max();
|
||||
mat.setTo(iMaxVal);
|
||||
|
||||
double min, max;
|
||||
@@ -1888,7 +1892,7 @@ TEST(MinMaxLoc, Mat_UcharMax_Without_Loc)
|
||||
TEST(MinMaxLoc, Mat_IntMax_Without_Mask)
|
||||
{
|
||||
Mat_<int> mat(50, 50);
|
||||
int iMaxVal = numeric_limits<int>::max();
|
||||
int iMaxVal = std::numeric_limits<int>::max();
|
||||
mat.setTo(iMaxVal);
|
||||
|
||||
double min, max;
|
||||
@@ -1957,8 +1961,8 @@ TEST(Compare, regression_8999)
|
||||
Mat_<double> B(1,1); B << 2;
|
||||
Mat C;
|
||||
ASSERT_ANY_THROW({
|
||||
compare(A, B, C, CMP_LT);
|
||||
});
|
||||
cv::compare(A, B, C, CMP_LT);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1982,7 +1986,7 @@ TEST(Core_minMaxIdx, regression_9207_1)
|
||||
Mat src(Size(cols, rows), CV_8UC1, src_);
|
||||
double minVal = -0.0, maxVal = -0.0;
|
||||
int minIdx[2] = { -2, -2 }, maxIdx[2] = { -2, -2 };
|
||||
minMaxIdx(src, &minVal, &maxVal, minIdx, maxIdx, mask);
|
||||
cv::minMaxIdx(src, &minVal, &maxVal, minIdx, maxIdx, mask);
|
||||
EXPECT_EQ(0, minIdx[0]);
|
||||
EXPECT_EQ(0, minIdx[1]);
|
||||
EXPECT_EQ(0, maxIdx[0]);
|
||||
@@ -2028,9 +2032,11 @@ TEST(Core_minMaxIdx, regression_9207_2)
|
||||
Mat src(Size(cols, rows), CV_8UC1, src_);
|
||||
double minVal = -0.0, maxVal = -0.0;
|
||||
int minIdx[2] = { -2, -2 }, maxIdx[2] = { -2, -2 };
|
||||
minMaxIdx(src, &minVal, &maxVal, minIdx, maxIdx, mask);
|
||||
cv::minMaxIdx(src, &minVal, &maxVal, minIdx, maxIdx, mask);
|
||||
EXPECT_EQ(0, minIdx[0]);
|
||||
EXPECT_EQ(14, minIdx[1]);
|
||||
EXPECT_EQ(0, maxIdx[0]);
|
||||
EXPECT_EQ(14, maxIdx[1]);
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
class Core_ConcatenationTest : public cvtest::BaseTest
|
||||
{
|
||||
@@ -145,3 +144,5 @@ TEST(Core_Concatenation, hconcat_empty_empty) { Core_ConcatenationTest test(true
|
||||
TEST(Core_Concatenation, vconcat_empty_nonempty) { Core_ConcatenationTest test(false, true, false); test.safe_run(); }
|
||||
TEST(Core_Concatenation, vconcat_nonempty_empty) { Core_ConcatenationTest test(false, false, true); test.safe_run(); }
|
||||
TEST(Core_Concatenation, vconcat_empty_empty) { Core_ConcatenationTest test(false, true, true); test.safe_run(); }
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
//
|
||||
//M*/
|
||||
#include "test_precomp.hpp"
|
||||
#include <cstdlib>
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
static void mytest(cv::Ptr<cv::ConjGradSolver> solver,cv::Ptr<cv::MinProblemSolver::Function> ptr_F,cv::Mat& x,
|
||||
cv::Mat& etalon_x,double etalon_res){
|
||||
@@ -103,3 +104,5 @@ TEST(Core_ConjGradSolver, regression_basic){
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -41,10 +41,8 @@
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include <time.h>
|
||||
#include <limits>
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
#define CORE_COUNTNONZERO_ERROR_COUNT 1
|
||||
|
||||
@@ -252,12 +250,12 @@ void CV_CountNonZeroTest::run(int)
|
||||
TEST (Core_CountNonZero, accuracy) { CV_CountNonZeroTest test; test.safe_run(); }
|
||||
|
||||
|
||||
typedef testing::TestWithParam<std::tr1::tuple<int, int> > CountNonZeroND;
|
||||
typedef testing::TestWithParam<tuple<int, int> > CountNonZeroND;
|
||||
|
||||
TEST_P (CountNonZeroND, ndim)
|
||||
{
|
||||
const int dims = std::tr1::get<0>(GetParam());
|
||||
const int type = std::tr1::get<1>(GetParam());
|
||||
const int dims = get<0>(GetParam());
|
||||
const int type = get<1>(GetParam());
|
||||
const int ONE_SIZE = 5;
|
||||
|
||||
vector<int> sizes(dims);
|
||||
@@ -277,3 +275,5 @@ INSTANTIATE_TEST_CASE_P(Core, CountNonZeroND,
|
||||
testing::Values(CV_8U, CV_8S, CV_32F)
|
||||
)
|
||||
);
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -39,9 +39,8 @@
|
||||
//
|
||||
//M*/
|
||||
#include "test_precomp.hpp"
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
static void mytest(cv::Ptr<cv::DownhillSolver> solver,cv::Ptr<cv::MinProblemSolver::Function> ptr_F,cv::Mat& x,cv::Mat& step,
|
||||
cv::Mat& etalon_x,double etalon_res){
|
||||
@@ -103,3 +102,5 @@ TEST(Core_DownhillSolver, regression_basic){
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
typedef struct CvTsSimpleSeq
|
||||
{
|
||||
@@ -2130,3 +2132,5 @@ TEST(Core_DS_Seq, sort_invert) { Core_SeqSortInvTest test; test.safe_run(); }
|
||||
TEST(Core_DS_Set, basic_operations) { Core_SetTest test; test.safe_run(); }
|
||||
TEST(Core_DS_Graph, basic_operations) { Core_GraphTest test; test.safe_run(); }
|
||||
TEST(Core_DS_Graph, scan) { Core_GraphScanTest test; test.safe_run(); }
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
namespace cvtest
|
||||
{
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
static Mat initDFTWave( int n, bool inv )
|
||||
{
|
||||
@@ -497,9 +496,6 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class CxCore_DXTBaseTest : public cvtest::ArrayTest
|
||||
{
|
||||
public:
|
||||
@@ -661,7 +657,7 @@ int CxCore_DXTBaseTest::prepare_test_case( int test_case_idx )
|
||||
int out_type = test_mat[OUTPUT][0].type();
|
||||
|
||||
if( CV_MAT_CN(in_type) == 2 && CV_MAT_CN(out_type) == 1 )
|
||||
cvtest::fixCCS( test_mat[INPUT][0], test_mat[OUTPUT][0].cols, flags );
|
||||
fixCCS( test_mat[INPUT][0], test_mat[OUTPUT][0].cols, flags );
|
||||
|
||||
if( inplace )
|
||||
cvtest::copy( test_mat[INPUT][test_case_idx & (int)spectrum_mode],
|
||||
@@ -718,22 +714,22 @@ void CxCore_DFTTest::prepare_to_validation( int /*test_case_idx*/ )
|
||||
if( !(flags & CV_DXT_INVERSE ) )
|
||||
{
|
||||
Mat& cvdft_dst = test_mat[TEMP][1];
|
||||
cvtest::convertFromCCS( cvdft_dst, cvdft_dst,
|
||||
test_mat[OUTPUT][0], flags );
|
||||
convertFromCCS( cvdft_dst, cvdft_dst,
|
||||
test_mat[OUTPUT][0], flags );
|
||||
*tmp_src = Scalar::all(0);
|
||||
cvtest::insert( src, *tmp_src, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
cvtest::convertFromCCS( src, src, *tmp_src, flags );
|
||||
convertFromCCS( src, src, *tmp_src, flags );
|
||||
tmp_dst = &test_mat[TEMP][1];
|
||||
}
|
||||
}
|
||||
|
||||
if( src.rows == 1 || (src.cols == 1 && !(flags & CV_DXT_ROWS)) )
|
||||
cvtest::DFT_1D( *tmp_src, *tmp_dst, flags );
|
||||
DFT_1D( *tmp_src, *tmp_dst, flags );
|
||||
else
|
||||
cvtest::DFT_2D( *tmp_src, *tmp_dst, flags );
|
||||
DFT_2D( *tmp_src, *tmp_dst, flags );
|
||||
|
||||
if( tmp_dst != &dst )
|
||||
cvtest::extract( *tmp_dst, dst, 0 );
|
||||
@@ -773,9 +769,9 @@ void CxCore_DCTTest::prepare_to_validation( int /*test_case_idx*/ )
|
||||
Mat& dst = test_mat[REF_OUTPUT][0];
|
||||
|
||||
if( src.rows == 1 || (src.cols == 1 && !(flags & CV_DXT_ROWS)) )
|
||||
cvtest::DCT_1D( src, dst, flags );
|
||||
DCT_1D( src, dst, flags );
|
||||
else
|
||||
cvtest::DCT_2D( src, dst, flags );
|
||||
DCT_2D( src, dst, flags );
|
||||
}
|
||||
|
||||
|
||||
@@ -837,17 +833,17 @@ void CxCore_MulSpectrumsTest::prepare_to_validation( int /*test_case_idx*/ )
|
||||
|
||||
if( cn == 1 )
|
||||
{
|
||||
cvtest::convertFromCCS( *src1, *src1, dst, flags );
|
||||
cvtest::convertFromCCS( *src2, *src2, dst0, flags );
|
||||
convertFromCCS( *src1, *src1, dst, flags );
|
||||
convertFromCCS( *src2, *src2, dst0, flags );
|
||||
src1 = &dst;
|
||||
src2 = &dst0;
|
||||
}
|
||||
|
||||
cvtest::mulComplex( *src1, *src2, dst0, flags );
|
||||
mulComplex( *src1, *src2, dst0, flags );
|
||||
if( cn == 1 )
|
||||
{
|
||||
Mat& temp = test_mat[TEMP][0];
|
||||
cvtest::convertFromCCS( temp, temp, dst, flags );
|
||||
convertFromCCS( temp, temp, dst, flags );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -900,7 +896,7 @@ TEST(Core_DFT, complex_output2)
|
||||
Mat x(m, n, type), out;
|
||||
randu(x, -1., 1.);
|
||||
dft(x, out, DFT_ROWS | DFT_COMPLEX_OUTPUT);
|
||||
double nrm = norm(out, NORM_INF);
|
||||
double nrm = cvtest::norm(out, NORM_INF);
|
||||
double thresh = n*m*2;
|
||||
if( nrm > thresh )
|
||||
{
|
||||
@@ -986,3 +982,5 @@ protected:
|
||||
|
||||
TEST(Core_DFT, reverse) { Core_DXTReverseTest test(Core_DXTReverseTest::ModeDFT); test.safe_run(); }
|
||||
TEST(Core_DCT, reverse) { Core_DXTReverseTest test(Core_DXTReverseTest::ModeDCT); test.safe_run(); }
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -39,12 +39,9 @@
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include <time.h>
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
#define sign(a) a > 0 ? 1 : a == 0 ? 0 : -1
|
||||
|
||||
@@ -374,7 +371,7 @@ bool Core_EigenTest::check_full(int type)
|
||||
{
|
||||
const int MAX_DEGREE = 7;
|
||||
|
||||
RNG rng = ::theRNG(); // fix the seed
|
||||
RNG rng = cv::theRNG(); // fix the seed
|
||||
|
||||
for (int i = 0; i < ntests; ++i)
|
||||
{
|
||||
@@ -518,3 +515,5 @@ static void testEigen3x3()
|
||||
}
|
||||
TEST(Core_EigenNonSymmetric, float3x3) { testEigen3x3<float>(); }
|
||||
TEST(Core_EigenNonSymmetric, double3x3) { testEigen3x3<double>(); }
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -38,10 +38,9 @@
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace cv;
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -111,7 +110,7 @@ TEST(Core_HAL, mathfuncs)
|
||||
t = (double)getTickCount() - t;
|
||||
min_ocv_t = std::min(min_ocv_t, t);
|
||||
}
|
||||
EXPECT_LE(norm(dst, dst0, NORM_INF | NORM_RELATIVE), eps);
|
||||
EXPECT_LE(cvtest::norm(dst, dst0, NORM_INF | NORM_RELATIVE), eps);
|
||||
|
||||
double freq = getTickFrequency();
|
||||
printf("%s (N=%d, %s): hal time=%.2fusec, ocv time=%.2fusec\n",
|
||||
@@ -120,8 +119,6 @@ TEST(Core_HAL, mathfuncs)
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
enum
|
||||
{
|
||||
HAL_LU = 0,
|
||||
@@ -188,7 +185,7 @@ TEST_P(HAL, mat_decomp)
|
||||
//std::cout << "x: " << Mat(x.t()) << std::endl;
|
||||
//std::cout << "x0: " << Mat(x0.t()) << std::endl;
|
||||
|
||||
EXPECT_LE(norm(x, x0, NORM_INF | NORM_RELATIVE), eps)
|
||||
EXPECT_LE(cvtest::norm(x, x0, NORM_INF | NORM_RELATIVE), eps)
|
||||
<< "x: " << Mat(x.t())
|
||||
<< "\nx0: " << Mat(x0.t())
|
||||
<< "\na0: " << a0
|
||||
@@ -205,4 +202,4 @@ TEST_P(HAL, mat_decomp)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Core, HAL, testing::Range(0, 16));
|
||||
|
||||
} // namespace
|
||||
}} // namespace
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "test_precomp.hpp"
|
||||
#include <climits>
|
||||
|
||||
#include "test_intrin_utils.hpp"
|
||||
|
||||
@@ -10,7 +12,7 @@
|
||||
|
||||
using namespace cv;
|
||||
|
||||
namespace cvtest { namespace hal {
|
||||
namespace opencv_test { namespace hal {
|
||||
using namespace CV_CPU_OPTIMIZATION_NAMESPACE;
|
||||
|
||||
//============= 8-bit integer =====================================================================
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "test_precomp.hpp"
|
||||
#include "test_intrin_utils.hpp"
|
||||
|
||||
namespace cvtest { namespace hal {
|
||||
namespace opencv_test { namespace hal {
|
||||
CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN
|
||||
|
||||
void test_hal_intrin_float16x4()
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "opencv2/core/hal/intrin.hpp"
|
||||
|
||||
namespace cvtest { namespace hal {
|
||||
namespace opencv_test { namespace hal {
|
||||
CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN
|
||||
|
||||
void test_hal_intrin_float16x4();
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
static SparseMat cvTsGetRandomSparseMat(int dims, const int* sz, int type,
|
||||
int nzcount, double a, double b, RNG& rng)
|
||||
@@ -122,7 +124,7 @@ protected:
|
||||
exp(test_mat, test_mat);
|
||||
Mat test_mat_scale(test_mat.size(), test_mat.type());
|
||||
rng0.fill(test_mat_scale, CV_RAND_UNI, Scalar::all(-1), Scalar::all(1));
|
||||
multiply(test_mat, test_mat_scale, test_mat);
|
||||
cv::multiply(test_mat, test_mat_scale, test_mat);
|
||||
}
|
||||
|
||||
CvSeq* seq = cvCreateSeq(test_mat.type(), (int)sizeof(CvSeq),
|
||||
@@ -158,7 +160,7 @@ protected:
|
||||
exp(test_mat_nd, test_mat_nd);
|
||||
MatND test_mat_scale(test_mat_nd.dims, test_mat_nd.size, test_mat_nd.type());
|
||||
rng0.fill(test_mat_scale, CV_RAND_UNI, Scalar::all(-1), Scalar::all(1));
|
||||
multiply(test_mat_nd, test_mat_scale, test_mat_nd);
|
||||
cv::multiply(test_mat_nd, test_mat_scale, test_mat_nd);
|
||||
}
|
||||
|
||||
int ssz[] = {
|
||||
@@ -387,8 +389,6 @@ protected:
|
||||
|
||||
TEST(Core_InputOutput, write_read_consistency) { Core_IOTest test; test.safe_run(); }
|
||||
|
||||
extern void testFormatter();
|
||||
|
||||
|
||||
struct UserDefinedType
|
||||
{
|
||||
@@ -1058,7 +1058,7 @@ TEST(Core_InputOutput, filestorage_vec_vec_io)
|
||||
|
||||
for(size_t k = 0; k < testMats[j].size(); k++)
|
||||
{
|
||||
ASSERT_TRUE(norm(outputMats[j][k] - testMats[j][k], NORM_INF) == 0);
|
||||
ASSERT_TRUE(cvtest::norm(outputMats[j][k] - testMats[j][k], NORM_INF) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1597,7 +1597,7 @@ TEST(Core_InputOutput, FileStorage_free_file_after_exception)
|
||||
const std::string fileName = "FileStorage_free_file_after_exception_test.yml";
|
||||
const std::string content = "%YAML:1.0\n cameraMatrix;:: !<tag:yaml.org,2002:opencv-matrix>\n";
|
||||
|
||||
fstream testFile;
|
||||
std::fstream testFile;
|
||||
testFile.open(fileName.c_str(), std::fstream::out);
|
||||
if(!testFile.is_open()) FAIL();
|
||||
testFile << content;
|
||||
@@ -1611,5 +1611,7 @@ TEST(Core_InputOutput, FileStorage_free_file_after_exception)
|
||||
catch (const std::exception&)
|
||||
{
|
||||
}
|
||||
ASSERT_EQ(std::remove(fileName.c_str()), 0);
|
||||
ASSERT_EQ(0, std::remove(fileName.c_str()));
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
@@ -6,9 +9,9 @@
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
using namespace cvtest;
|
||||
using namespace opencv_test;
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
PARAM_TEST_CASE(IPPAsync, MatDepth, Channels, hppAccelType)
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
//
|
||||
//M*/
|
||||
#include "test_precomp.hpp"
|
||||
#include <iostream>
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
TEST(Core_LPSolver, regression_basic){
|
||||
cv::Mat A,B,z,etalon_z;
|
||||
@@ -139,3 +140,5 @@ TEST(Core_LPSolver, regression_cycling){
|
||||
//ASSERT_EQ(res,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#ifdef _MSC_VER
|
||||
# if _MSC_VER >= 1700
|
||||
# pragma warning(disable:4447) // Disable warning 'main' signature found without threading model
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
CV_TEST_MAIN("cv")
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#include <map>
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
class Core_ReduceTest : public cvtest::BaseTest
|
||||
{
|
||||
@@ -770,8 +769,8 @@ void Core_ArrayOpTest::run( int /* start_from */)
|
||||
SparseMat M( dims, size, depth );
|
||||
map<string, double> M0;
|
||||
|
||||
int nz0 = (unsigned)rng % max(p/5,10);
|
||||
nz0 = min(max(nz0, 1), p);
|
||||
int nz0 = (unsigned)rng % std::max(p/5,10);
|
||||
nz0 = std::min(std::max(nz0, 1), p);
|
||||
all_vals.resize(nz0);
|
||||
all_vals2.resize(nz0);
|
||||
Mat_<double> _all_vals(all_vals), _all_vals2(all_vals2);
|
||||
@@ -791,9 +790,9 @@ void Core_ArrayOpTest::run( int /* start_from */)
|
||||
}
|
||||
|
||||
minMaxLoc(_all_vals, &min_val, &max_val);
|
||||
double _norm0 = cvtest::norm(_all_vals, CV_C);
|
||||
double _norm1 = cvtest::norm(_all_vals, CV_L1);
|
||||
double _norm2 = cvtest::norm(_all_vals, CV_L2);
|
||||
double _norm0 = cv/*test*/::norm(_all_vals, CV_C);
|
||||
double _norm1 = cv/*test*/::norm(_all_vals, CV_L1);
|
||||
double _norm2 = cv/*test*/::norm(_all_vals, CV_L2);
|
||||
|
||||
for( i = 0; i < nz0; i++ )
|
||||
{
|
||||
@@ -828,9 +827,9 @@ void Core_ArrayOpTest::run( int /* start_from */)
|
||||
SparseMat M3; SparseMat(Md).convertTo(M3, Md.type(), 2);
|
||||
|
||||
int nz1 = (int)M.nzcount(), nz2 = (int)M3.nzcount();
|
||||
double norm0 = norm(M, CV_C);
|
||||
double norm1 = norm(M, CV_L1);
|
||||
double norm2 = norm(M, CV_L2);
|
||||
double norm0 = cv/*test*/::norm(M, CV_C);
|
||||
double norm1 = cv/*test*/::norm(M, CV_L1);
|
||||
double norm2 = cv/*test*/::norm(M, CV_L2);
|
||||
double eps = depth == CV_32F ? FLT_EPSILON*100 : DBL_EPSILON*1000;
|
||||
|
||||
if( nz1 != nz0 || nz2 != nz0)
|
||||
@@ -851,8 +850,8 @@ void Core_ArrayOpTest::run( int /* start_from */)
|
||||
break;
|
||||
}
|
||||
|
||||
int n = (unsigned)rng % max(p/5,10);
|
||||
n = min(max(n, 1), p) + nz0;
|
||||
int n = (unsigned)rng % std::max(p/5,10);
|
||||
n = std::min(std::max(n, 1), p) + nz0;
|
||||
|
||||
for( i = 0; i < n; i++ )
|
||||
{
|
||||
@@ -919,7 +918,7 @@ void Core_ArrayOpTest::run( int /* start_from */)
|
||||
int idx1[MAX_DIM], idx2[MAX_DIM];
|
||||
double val1 = 0, val2 = 0;
|
||||
M3 = SparseMat(Md);
|
||||
minMaxLoc(M3, &val1, &val2, idx1, idx2);
|
||||
cv::minMaxLoc(M3, &val1, &val2, idx1, idx2);
|
||||
string s1 = idx2string(idx1, dims), s2 = idx2string(idx2, dims);
|
||||
if( val1 != min_val || val2 != max_val || s1 != min_sidx || s2 != max_sidx )
|
||||
{
|
||||
@@ -930,7 +929,7 @@ void Core_ArrayOpTest::run( int /* start_from */)
|
||||
break;
|
||||
}
|
||||
|
||||
minMaxIdx(Md, &val1, &val2, idx1, idx2);
|
||||
cv::minMaxIdx(Md, &val1, &val2, idx1, idx2);
|
||||
s1 = idx2string(idx1, dims), s2 = idx2string(idx2, dims);
|
||||
if( (min_val < 0 && (val1 != min_val || s1 != min_sidx)) ||
|
||||
(max_val > 0 && (val2 != max_val || s2 != max_sidx)) )
|
||||
@@ -1066,7 +1065,7 @@ protected:
|
||||
merge(src, dst);
|
||||
|
||||
// check result
|
||||
stringstream commonLog;
|
||||
std::stringstream commonLog;
|
||||
commonLog << "Depth " << depth << " :";
|
||||
if(dst.depth() != depth)
|
||||
{
|
||||
@@ -1115,7 +1114,7 @@ protected:
|
||||
split(src, dst);
|
||||
|
||||
// check result
|
||||
stringstream commonLog;
|
||||
std::stringstream commonLog;
|
||||
commonLog << "Depth " << depth << " :";
|
||||
if(dst.size() != channels)
|
||||
{
|
||||
@@ -1391,7 +1390,7 @@ TEST(Core_SVD, orthogonality)
|
||||
Mat mat_U, mat_W;
|
||||
SVD::compute(mat_D, mat_W, mat_U, noArray(), SVD::FULL_UV);
|
||||
mat_U *= mat_U.t();
|
||||
ASSERT_LT(norm(mat_U, Mat::eye(2, 2, type), NORM_INF), 1e-5);
|
||||
ASSERT_LT(cvtest::norm(mat_U, Mat::eye(2, 2, type), NORM_INF), 1e-5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1713,7 +1712,7 @@ TEST(Mat_, range_based_for)
|
||||
|
||||
Mat_<uchar> ref(3, 3);
|
||||
ref.setTo(Scalar(1));
|
||||
ASSERT_DOUBLE_EQ(norm(img, ref), 0.);
|
||||
ASSERT_DOUBLE_EQ(cvtest::norm(img, ref, NORM_INF), 0.);
|
||||
}
|
||||
|
||||
TEST(Mat, from_initializer_list)
|
||||
@@ -1722,7 +1721,7 @@ TEST(Mat, from_initializer_list)
|
||||
Mat_<float> B(3, 1); B << 1, 2, 3;
|
||||
|
||||
ASSERT_EQ(A.type(), CV_32F);
|
||||
ASSERT_DOUBLE_EQ(norm(A, B, NORM_INF), 0.);
|
||||
ASSERT_DOUBLE_EQ(cvtest::norm(A, B, NORM_INF), 0.);
|
||||
}
|
||||
|
||||
TEST(Mat_, from_initializer_list)
|
||||
@@ -1730,7 +1729,7 @@ TEST(Mat_, from_initializer_list)
|
||||
Mat_<float> A = {1, 2, 3};
|
||||
Mat_<float> B(3, 1); B << 1, 2, 3;
|
||||
|
||||
ASSERT_DOUBLE_EQ(norm(A, B, NORM_INF), 0.);
|
||||
ASSERT_DOUBLE_EQ(cvtest::norm(A, B, NORM_INF), 0.);
|
||||
}
|
||||
|
||||
|
||||
@@ -1754,3 +1753,5 @@ TEST(Mat_, template_based_ptr)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////// tests for matrix operations and math functions ///////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -7,8 +11,7 @@
|
||||
#include <math.h>
|
||||
#include "opencv2/core/softfloat.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
/// !!! NOTE !!! These tests happily avoid overflow cases & out-of-range arguments
|
||||
/// so that output arrays contain neigher Inf's nor Nan's.
|
||||
@@ -3079,7 +3082,7 @@ TEST(Core_Cholesky, accuracy64f)
|
||||
for (int i = 0; i < A.rows; i++)
|
||||
for (int j = i + 1; j < A.cols; j++)
|
||||
A.at<double>(i, j) = 0.0;
|
||||
EXPECT_LE(norm(refA, A*A.t(), CV_RELATIVE_L2), FLT_EPSILON);
|
||||
EXPECT_LE(cvtest::norm(refA, A*A.t(), CV_RELATIVE_L2), FLT_EPSILON);
|
||||
}
|
||||
|
||||
TEST(Core_QR_Solver, accuracy64f)
|
||||
@@ -3099,7 +3102,7 @@ TEST(Core_QR_Solver, accuracy64f)
|
||||
|
||||
//solve system with square matrix
|
||||
solve(A, B, solutionQR, DECOMP_QR);
|
||||
EXPECT_LE(norm(A*solutionQR, B, CV_RELATIVE_L2), FLT_EPSILON);
|
||||
EXPECT_LE(cvtest::norm(A*solutionQR, B, CV_RELATIVE_L2), FLT_EPSILON);
|
||||
|
||||
A = Mat(m, n, CV_64F);
|
||||
B = Mat(m, n, CV_64F);
|
||||
@@ -3108,13 +3111,13 @@ TEST(Core_QR_Solver, accuracy64f)
|
||||
|
||||
//solve normal system
|
||||
solve(A, B, solutionQR, DECOMP_QR | DECOMP_NORMAL);
|
||||
EXPECT_LE(norm(A.t()*(A*solutionQR), A.t()*B, CV_RELATIVE_L2), FLT_EPSILON);
|
||||
EXPECT_LE(cvtest::norm(A.t()*(A*solutionQR), A.t()*B, CV_RELATIVE_L2), FLT_EPSILON);
|
||||
|
||||
//solve overdeterminated system as a least squares problem
|
||||
Mat solutionSVD;
|
||||
solve(A, B, solutionQR, DECOMP_QR);
|
||||
solve(A, B, solutionSVD, DECOMP_SVD);
|
||||
EXPECT_LE(norm(solutionQR, solutionSVD, CV_RELATIVE_L2), FLT_EPSILON);
|
||||
EXPECT_LE(cvtest::norm(solutionQR, solutionSVD, CV_RELATIVE_L2), FLT_EPSILON);
|
||||
|
||||
//solve system with singular matrix
|
||||
A = Mat(10, 10, CV_64F);
|
||||
@@ -3718,7 +3721,7 @@ TEST(Core_SoftFloat, sincos64)
|
||||
softdouble x = inputs[i];
|
||||
|
||||
int xexp = x.getExp();
|
||||
softdouble randEps = eps.setExp(max(xexp-52, -46));
|
||||
softdouble randEps = eps.setExp(std::max(xexp-52, -46));
|
||||
softdouble sx = sin(x);
|
||||
softdouble cx = cos(x);
|
||||
ASSERT_FALSE(sx.isInf()); ASSERT_FALSE(cx.isInf());
|
||||
@@ -3862,4 +3865,5 @@ TEST(Core_SoftFloat, CvRound)
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
/* End of file. */
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
TEST(Core_OutputArrayCreate, _1997)
|
||||
{
|
||||
@@ -154,3 +156,5 @@ TEST(Core_Copy, repeat_regression_8972)
|
||||
repeat(src, 5, 1, src);
|
||||
});
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp" // T-API like tests
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace {
|
||||
|
||||
class CV_OperationsTest : public cvtest::BaseTest
|
||||
@@ -134,16 +134,16 @@ bool CV_OperationsTest::TestMat()
|
||||
res = Mat(Mat(2 * rot_2x3) * res - shi_2x1) + shift;
|
||||
|
||||
Mat tmp, res2;
|
||||
add(one_3x1, shi_3x1, tmp);
|
||||
add(tmp, shi_3x1, tmp);
|
||||
add(tmp, shi_3x1, tmp);
|
||||
gemm(rot_2x3, tmp, 2, shi_2x1, -1, res2, 0);
|
||||
add(res2, Mat(2, 1, CV_32F, shift), res2);
|
||||
cv::add(one_3x1, shi_3x1, tmp);
|
||||
cv::add(tmp, shi_3x1, tmp);
|
||||
cv::add(tmp, shi_3x1, tmp);
|
||||
cv::gemm(rot_2x3, tmp, 2, shi_2x1, -1, res2, 0);
|
||||
cv::add(res2, Mat(2, 1, CV_32F, shift), res2);
|
||||
|
||||
CHECK_DIFF(res, res2);
|
||||
|
||||
Mat mat4x4(4, 4, CV_32F);
|
||||
randu(mat4x4, Scalar(0), Scalar(10));
|
||||
cv::randu(mat4x4, Scalar(0), Scalar(10));
|
||||
|
||||
Mat roi1 = mat4x4(Rect(Point(1, 1), Size(2, 2)));
|
||||
Mat roi2 = mat4x4(Range(1, 3), Range(1, 3));
|
||||
@@ -508,19 +508,19 @@ bool CV_OperationsTest::TestTemplateMat()
|
||||
Mat_<float> resS = rot_2x3 * one_3x1;
|
||||
|
||||
Mat_<float> tmp, res2, resS2;
|
||||
add(one_3x1, shi_3x1, tmp);
|
||||
add(tmp, shi_3x1, tmp);
|
||||
add(tmp, shi_3x1, tmp);
|
||||
gemm(rot_2x3, tmp, 2, shi_2x1, -1, res2, 0);
|
||||
add(res2, Mat(2, 1, CV_32F, shift), res2);
|
||||
cv::add(one_3x1, shi_3x1, tmp);
|
||||
cv::add(tmp, shi_3x1, tmp);
|
||||
cv::add(tmp, shi_3x1, tmp);
|
||||
cv::gemm(rot_2x3, tmp, 2, shi_2x1, -1, res2, 0);
|
||||
cv::add(res2, Mat(2, 1, CV_32F, shift), res2);
|
||||
|
||||
gemm(rot_2x3, one_3x1, 1, shi_2x1, 0, resS2, 0);
|
||||
cv::gemm(rot_2x3, one_3x1, 1, shi_2x1, 0, resS2, 0);
|
||||
CHECK_DIFF(res, res2);
|
||||
CHECK_DIFF(resS, resS2);
|
||||
|
||||
|
||||
Mat_<float> mat4x4(4, 4);
|
||||
randu(mat4x4, Scalar(0), Scalar(10));
|
||||
cv::randu(mat4x4, Scalar(0), Scalar(10));
|
||||
|
||||
Mat_<float> roi1 = mat4x4(Rect(Point(1, 1), Size(2, 2)));
|
||||
Mat_<float> roi2 = mat4x4(Range(1, 3), Range(1, 3));
|
||||
@@ -988,17 +988,17 @@ bool CV_OperationsTest::operations1()
|
||||
Mat A(1, 32, CV_32F), B;
|
||||
for( int i = 0; i < A.cols; i++ )
|
||||
A.at<float>(i) = (float)(i <= 12 ? i : 24 - i);
|
||||
transpose(A, B);
|
||||
cv::transpose(A, B);
|
||||
|
||||
int minidx[2] = {0, 0}, maxidx[2] = {0, 0};
|
||||
double minval = 0, maxval = 0;
|
||||
minMaxIdx(A, &minval, &maxval, minidx, maxidx);
|
||||
cv::minMaxIdx(A, &minval, &maxval, minidx, maxidx);
|
||||
|
||||
if( !(minidx[0] == 0 && minidx[1] == 31 && maxidx[0] == 0 && maxidx[1] == 12 &&
|
||||
minval == -7 && maxval == 12))
|
||||
throw test_excep();
|
||||
|
||||
minMaxIdx(B, &minval, &maxval, minidx, maxidx);
|
||||
cv::minMaxIdx(B, &minval, &maxval, minidx, maxidx);
|
||||
|
||||
if( !(minidx[0] == 31 && minidx[1] == 0 && maxidx[0] == 12 && maxidx[1] == 0 &&
|
||||
minval == -7 && maxval == 12))
|
||||
@@ -1006,13 +1006,13 @@ bool CV_OperationsTest::operations1()
|
||||
|
||||
Matx33f b(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f);
|
||||
Mat c;
|
||||
add(Mat::zeros(3, 3, CV_32F), b, c);
|
||||
cv::add(Mat::zeros(3, 3, CV_32F), b, c);
|
||||
CV_Assert( cvtest::norm(b, c, CV_C) == 0 );
|
||||
|
||||
add(Mat::zeros(3, 3, CV_64F), b, c, noArray(), c.type());
|
||||
cv::add(Mat::zeros(3, 3, CV_64F), b, c, noArray(), c.type());
|
||||
CV_Assert( cvtest::norm(b, c, CV_C) == 0 );
|
||||
|
||||
add(Mat::zeros(6, 1, CV_64F), 1, c, noArray(), c.type());
|
||||
cv::add(Mat::zeros(6, 1, CV_64F), 1, c, noArray(), c.type());
|
||||
CV_Assert( cvtest::norm(Matx61f(1.f, 1.f, 1.f, 1.f, 1.f, 1.f), c, CV_C) == 0 );
|
||||
|
||||
vector<Point2f> pt2d(3);
|
||||
@@ -1025,7 +1025,7 @@ bool CV_OperationsTest::operations1()
|
||||
0.9058f, 0.0975f, 0.9649f, 0.4854f,
|
||||
0.1270f, 0.2785f, 0.1576f, 0.8003f,
|
||||
0.9134f, 0.5469f, 0.9706f, 0.1419f);
|
||||
double d = determinant(m44);
|
||||
double d = cv::determinant(m44);
|
||||
CV_Assert( fabs(d - (-0.0262)) <= 0.001 );
|
||||
|
||||
Cv32suf z;
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
# if defined __clang__ || defined __APPLE__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||
# pragma GCC diagnostic ignored "-Wextra"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#ifndef __OPENCV_TEST_PRECOMP_HPP__
|
||||
#define __OPENCV_TEST_PRECOMP_HPP__
|
||||
|
||||
#include <iostream>
|
||||
#include "opencv2/ts.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
#include "opencv2/core/core_c.h"
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
#ifdef GTEST_CAN_COMPARE_NULL
|
||||
# define EXPECT_NULL(ptr) EXPECT_EQ(NULL, ptr)
|
||||
#else
|
||||
@@ -366,6 +368,8 @@ TEST(Core_Ptr, make)
|
||||
EXPECT_TRUE(deleted);
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
namespace {
|
||||
|
||||
struct SpeciallyDeletable
|
||||
@@ -385,6 +389,8 @@ void DefaultDeleter<SpeciallyDeletable>::operator()(SpeciallyDeletable * obj) co
|
||||
|
||||
}
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
TEST(Core_Ptr, specialized_deleter)
|
||||
{
|
||||
SpeciallyDeletable sd;
|
||||
@@ -393,3 +399,5 @@ TEST(Core_Ptr, specialized_deleter)
|
||||
|
||||
ASSERT_TRUE(sd.deleted);
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
class Core_RandTest : public cvtest::BaseTest
|
||||
{
|
||||
@@ -383,7 +385,6 @@ TEST(Core_Rand, Regression_Stack_Corruption)
|
||||
ASSERT_EQ(param2, 2);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class RandRowFillParallelLoopBody : public cv::ParallelLoopBody
|
||||
{
|
||||
@@ -417,4 +418,4 @@ TEST(Core_Rand, parallel_for_stable_results)
|
||||
ASSERT_EQ(0, countNonZero(dst1 != dst2));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
}} // namespace
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
class Core_RotatedRectConstructorTest : public cvtest::BaseTest
|
||||
{
|
||||
@@ -72,7 +71,7 @@ int Core_RotatedRectConstructorTest::prepare_test_case( int test_case_idx )
|
||||
{
|
||||
b = Point2f( rng.uniform(-MAX_COORD_VAL, MAX_COORD_VAL), rng.uniform(-MAX_COORD_VAL, MAX_COORD_VAL) );
|
||||
}
|
||||
while( norm(a - b) <= FLT_EPSILON );
|
||||
while( cv::norm(a - b) <= FLT_EPSILON );
|
||||
Vec2f along(a - b);
|
||||
Vec2f perp = Vec2f(-along[1], along[0]);
|
||||
double d = (double) rng.uniform(1.0f, 5.0f);
|
||||
@@ -93,9 +92,9 @@ int Core_RotatedRectConstructorTest::validate_test_results( int )
|
||||
int count_match = 0;
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
if( norm(vertices[i] - a) <= 0.001 ) count_match++;
|
||||
else if( norm(vertices[i] - b) <= 0.001 ) count_match++;
|
||||
else if( norm(vertices[i] - c) <= 0.001 ) count_match++;
|
||||
if( cv::norm(vertices[i] - a) <= 0.001 ) count_match++;
|
||||
else if( cv::norm(vertices[i] - b) <= 0.001 ) count_match++;
|
||||
else if( cv::norm(vertices[i] - c) <= 0.001 ) count_match++;
|
||||
}
|
||||
if( count_match == 3 )
|
||||
return cvtest::TS::OK;
|
||||
@@ -105,3 +104,5 @@ int Core_RotatedRectConstructorTest::validate_test_results( int )
|
||||
}
|
||||
|
||||
TEST(Core_RotatedRect, three_point_constructor) { Core_RotatedRectConstructorTest test; test.safe_run(); }
|
||||
|
||||
}} // namespace
|
||||
|
||||
@@ -42,11 +42,11 @@
|
||||
#include "test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
using namespace cvtest;
|
||||
using namespace opencv_test;
|
||||
using namespace testing;
|
||||
using namespace cv;
|
||||
|
||||
namespace cvtest {
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
#define UMAT_TEST_SIZES testing::Values(cv::Size(1, 1), cv::Size(1,128), cv::Size(128, 1), \
|
||||
@@ -1073,7 +1073,7 @@ TEST(UMat, async_unmap)
|
||||
Mat m = Mat(1000, 1000, CV_8UC1, Scalar::all(0));
|
||||
UMat u = m.getUMat(ACCESS_READ);
|
||||
UMat dst;
|
||||
add(u, Scalar::all(0), dst); // start async operation
|
||||
cv::add(u, Scalar::all(0), dst); // start async operation
|
||||
u.release();
|
||||
m.release();
|
||||
}
|
||||
@@ -1233,7 +1233,7 @@ TEST(UMat, DISABLED_Test_same_behaviour_read_and_read)
|
||||
UMat u(Size(10, 10), CV_8UC1, Scalar::all(0));
|
||||
Mat m = u.getMat(ACCESS_READ);
|
||||
UMat dst;
|
||||
add(u, Scalar::all(1), dst);
|
||||
cv::add(u, Scalar::all(1), dst);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -1250,7 +1250,7 @@ TEST(UMat, DISABLED_Test_same_behaviour_read_and_write)
|
||||
{
|
||||
UMat u(Size(10, 10), CV_8UC1, Scalar::all(0));
|
||||
Mat m = u.getMat(ACCESS_READ);
|
||||
add(u, Scalar::all(1), u);
|
||||
cv::add(u, Scalar::all(1), u);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -1267,7 +1267,7 @@ TEST(UMat, DISABLED_Test_same_behaviour_write_and_read)
|
||||
UMat u(Size(10, 10), CV_8UC1, Scalar::all(0));
|
||||
Mat m = u.getMat(ACCESS_WRITE);
|
||||
UMat dst;
|
||||
add(u, Scalar::all(1), dst);
|
||||
cv::add(u, Scalar::all(1), dst);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -1283,7 +1283,7 @@ TEST(UMat, DISABLED_Test_same_behaviour_write_and_write)
|
||||
{
|
||||
UMat u(Size(10, 10), CV_8UC1, Scalar::all(0));
|
||||
Mat m = u.getMat(ACCESS_WRITE);
|
||||
add(u, Scalar::all(1), u);
|
||||
cv::add(u, Scalar::all(1), u);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -1301,7 +1301,7 @@ TEST(UMat, mat_umat_sync)
|
||||
}
|
||||
|
||||
UMat uDiff;
|
||||
compare(u, 255, uDiff, CMP_NE);
|
||||
cv::compare(u, 255, uDiff, CMP_NE);
|
||||
ASSERT_EQ(0, countNonZero(uDiff));
|
||||
}
|
||||
|
||||
@@ -1314,7 +1314,7 @@ TEST(UMat, testTempObjects_UMat)
|
||||
}
|
||||
|
||||
UMat uDiff;
|
||||
compare(u, 255, uDiff, CMP_NE);
|
||||
cv::compare(u, 255, uDiff, CMP_NE);
|
||||
ASSERT_EQ(0, countNonZero(uDiff));
|
||||
}
|
||||
|
||||
@@ -1383,4 +1383,4 @@ TEST(UMat, testTempObjects_Mat_issue_8693)
|
||||
EXPECT_EQ(0, cvtest::norm(srcUMat.getMat(ACCESS_READ), srcMat, NORM_INF));
|
||||
}
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
namespace {
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
static const char * const keys =
|
||||
"{ h help | | print help }"
|
||||
@@ -264,4 +261,4 @@ TEST(AutoBuffer, allocate_test)
|
||||
EXPECT_EQ(6u, abuf.size());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
}} // namespace
|
||||
|
||||
Reference in New Issue
Block a user