fixed gpu test failure on empty test data
This commit is contained in:
@@ -43,18 +43,14 @@
|
|||||||
|
|
||||||
#ifdef HAVE_CUDA
|
#ifdef HAVE_CUDA
|
||||||
|
|
||||||
struct StereoTest : testing::TestWithParam<cv::gpu::DeviceInfo>
|
//////////////////////////////////////////////////////////////////////////
|
||||||
{
|
// BlockMatching
|
||||||
static cv::Mat img_l;
|
|
||||||
static cv::Mat img_r;
|
|
||||||
static cv::Mat img_template;
|
|
||||||
|
|
||||||
static void TearDownTestCase()
|
struct StereoBlockMatching : testing::TestWithParam<cv::gpu::DeviceInfo>
|
||||||
{
|
{
|
||||||
img_l.release();
|
cv::Mat img_l;
|
||||||
img_r.release();
|
cv::Mat img_r;
|
||||||
img_template.release();
|
cv::Mat img_template;
|
||||||
}
|
|
||||||
|
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
|
|
||||||
@@ -63,30 +59,19 @@ struct StereoTest : testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
devInfo = GetParam();
|
devInfo = GetParam();
|
||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
cv::Mat StereoTest::img_l;
|
|
||||||
cv::Mat StereoTest::img_r;
|
|
||||||
cv::Mat StereoTest::img_template;
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// BlockMatching
|
|
||||||
|
|
||||||
struct StereoBlockMatching : StereoTest
|
|
||||||
{
|
|
||||||
static void SetUpTestCase()
|
|
||||||
{
|
|
||||||
img_l = readImage("stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
|
img_l = readImage("stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||||
img_r = readImage("stereobm/aloe-R.png", CV_LOAD_IMAGE_GRAYSCALE);
|
img_r = readImage("stereobm/aloe-R.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||||
img_template = readImage("stereobm/aloe-disp.png", CV_LOAD_IMAGE_GRAYSCALE);
|
img_template = readImage("stereobm/aloe-disp.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||||
|
|
||||||
|
ASSERT_FALSE(img_l.empty());
|
||||||
|
ASSERT_FALSE(img_r.empty());
|
||||||
|
ASSERT_FALSE(img_template.empty());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(StereoBlockMatching, Regression)
|
TEST_P(StereoBlockMatching, Regression)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img_l.empty() && !img_r.empty() && !img_template.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
|
|
||||||
cv::Mat disp;
|
cv::Mat disp;
|
||||||
@@ -110,20 +95,32 @@ INSTANTIATE_TEST_CASE_P(Calib3D, StereoBlockMatching, testing::ValuesIn(devices(
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// BeliefPropagation
|
// BeliefPropagation
|
||||||
|
|
||||||
struct StereoBeliefPropagation : StereoTest
|
struct StereoBeliefPropagation : testing::TestWithParam<cv::gpu::DeviceInfo>
|
||||||
{
|
{
|
||||||
static void SetUpTestCase()
|
cv::Mat img_l;
|
||||||
|
cv::Mat img_r;
|
||||||
|
cv::Mat img_template;
|
||||||
|
|
||||||
|
cv::gpu::DeviceInfo devInfo;
|
||||||
|
|
||||||
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
|
devInfo = GetParam();
|
||||||
|
|
||||||
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
img_l = readImage("stereobp/aloe-L.png");
|
img_l = readImage("stereobp/aloe-L.png");
|
||||||
img_r = readImage("stereobp/aloe-R.png");
|
img_r = readImage("stereobp/aloe-R.png");
|
||||||
img_template = readImage("stereobp/aloe-disp.png", CV_LOAD_IMAGE_GRAYSCALE);
|
img_template = readImage("stereobp/aloe-disp.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||||
|
|
||||||
|
ASSERT_FALSE(img_l.empty());
|
||||||
|
ASSERT_FALSE(img_r.empty());
|
||||||
|
ASSERT_FALSE(img_template.empty());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(StereoBeliefPropagation, Regression)
|
TEST_P(StereoBeliefPropagation, Regression)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img_l.empty() && !img_r.empty() && !img_template.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
|
|
||||||
cv::Mat disp;
|
cv::Mat disp;
|
||||||
@@ -147,29 +144,36 @@ INSTANTIATE_TEST_CASE_P(Calib3D, StereoBeliefPropagation, testing::ValuesIn(devi
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// ConstantSpaceBP
|
// ConstantSpaceBP
|
||||||
|
|
||||||
struct StereoConstantSpaceBP : StereoTest
|
struct StereoConstantSpaceBP : testing::TestWithParam<cv::gpu::DeviceInfo>
|
||||||
{
|
{
|
||||||
static void SetUpTestCase()
|
cv::Mat img_l;
|
||||||
{
|
cv::Mat img_r;
|
||||||
img_l = readImage("csstereobp/aloe-L.png");
|
cv::Mat img_template;
|
||||||
img_r = readImage("csstereobp/aloe-R.png");
|
|
||||||
}
|
cv::gpu::DeviceInfo devInfo;
|
||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
StereoTest::SetUp();
|
devInfo = GetParam();
|
||||||
|
|
||||||
if (supportFeature(GetParam(), cv::gpu::FEATURE_SET_COMPUTE_20))
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
img_l = readImage("csstereobp/aloe-L.png");
|
||||||
|
img_r = readImage("csstereobp/aloe-R.png");
|
||||||
|
|
||||||
|
if (supportFeature(devInfo, cv::gpu::FEATURE_SET_COMPUTE_20))
|
||||||
img_template = readImage("csstereobp/aloe-disp.png", CV_LOAD_IMAGE_GRAYSCALE);
|
img_template = readImage("csstereobp/aloe-disp.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||||
else
|
else
|
||||||
img_template = readImage("csstereobp/aloe-disp_CC1X.png", CV_LOAD_IMAGE_GRAYSCALE);
|
img_template = readImage("csstereobp/aloe-disp_CC1X.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||||
|
|
||||||
|
ASSERT_FALSE(img_l.empty());
|
||||||
|
ASSERT_FALSE(img_r.empty());
|
||||||
|
ASSERT_FALSE(img_template.empty());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(StereoConstantSpaceBP, Regression)
|
TEST_P(StereoConstantSpaceBP, Regression)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img_l.empty() && !img_r.empty() && !img_template.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
|
|
||||||
cv::Mat disp;
|
cv::Mat disp;
|
||||||
|
@@ -48,29 +48,10 @@
|
|||||||
|
|
||||||
struct SURF : testing::TestWithParam<cv::gpu::DeviceInfo>
|
struct SURF : testing::TestWithParam<cv::gpu::DeviceInfo>
|
||||||
{
|
{
|
||||||
static cv::Mat image;
|
cv::Mat image;
|
||||||
static cv::Mat mask;
|
cv::Mat mask;
|
||||||
static std::vector<cv::KeyPoint> keypoints_gold;
|
std::vector<cv::KeyPoint> keypoints_gold;
|
||||||
static std::vector<float> descriptors_gold;
|
std::vector<float> descriptors_gold;
|
||||||
|
|
||||||
static void SetUpTestCase()
|
|
||||||
{
|
|
||||||
image = readImage("features2d/aloe.png", CV_LOAD_IMAGE_GRAYSCALE);
|
|
||||||
|
|
||||||
mask = cv::Mat(image.size(), CV_8UC1, cv::Scalar::all(1));
|
|
||||||
mask(cv::Range(0, image.rows / 2), cv::Range(0, image.cols / 2)).setTo(cv::Scalar::all(0));
|
|
||||||
|
|
||||||
cv::SURF fdetector_gold; fdetector_gold.extended = false;
|
|
||||||
fdetector_gold(image, mask, keypoints_gold, descriptors_gold);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TearDownTestCase()
|
|
||||||
{
|
|
||||||
image.release();
|
|
||||||
mask.release();
|
|
||||||
keypoints_gold.clear();
|
|
||||||
descriptors_gold.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
|
|
||||||
@@ -79,6 +60,15 @@ struct SURF : testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
devInfo = GetParam();
|
devInfo = GetParam();
|
||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
image = readImage("features2d/aloe.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||||
|
ASSERT_FALSE(image.empty());
|
||||||
|
|
||||||
|
mask = cv::Mat(image.size(), CV_8UC1, cv::Scalar::all(1));
|
||||||
|
mask(cv::Range(0, image.rows / 2), cv::Range(0, image.cols / 2)).setTo(cv::Scalar::all(0));
|
||||||
|
|
||||||
|
cv::SURF fdetector_gold; fdetector_gold.extended = false;
|
||||||
|
fdetector_gold(image, mask, keypoints_gold, descriptors_gold);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSimilarKeypoints(const cv::KeyPoint& p1, const cv::KeyPoint& p2)
|
bool isSimilarKeypoints(const cv::KeyPoint& p1, const cv::KeyPoint& p2)
|
||||||
@@ -98,11 +88,6 @@ struct SURF : testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
cv::Mat SURF::image;
|
|
||||||
cv::Mat SURF::mask;
|
|
||||||
std::vector<cv::KeyPoint> SURF::keypoints_gold;
|
|
||||||
std::vector<float> SURF::descriptors_gold;
|
|
||||||
|
|
||||||
TEST_P(SURF, EmptyDataTest)
|
TEST_P(SURF, EmptyDataTest)
|
||||||
{
|
{
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
@@ -123,8 +108,6 @@ TEST_P(SURF, EmptyDataTest)
|
|||||||
|
|
||||||
TEST_P(SURF, Accuracy)
|
TEST_P(SURF, Accuracy)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!image.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
|
|
||||||
// Compute keypoints.
|
// Compute keypoints.
|
||||||
|
@@ -43,40 +43,21 @@
|
|||||||
|
|
||||||
#ifdef HAVE_CUDA
|
#ifdef HAVE_CUDA
|
||||||
|
|
||||||
struct FilterTest
|
namespace
|
||||||
{
|
{
|
||||||
static cv::Mat img_rgba;
|
double checkNorm(const cv::Mat& m1, const cv::Mat& m2, const cv::Size& ksize)
|
||||||
static cv::Mat img_gray;
|
|
||||||
|
|
||||||
static void SetUpTestCase()
|
|
||||||
{
|
|
||||||
cv::Mat img = readImage("stereobp/aloe-L.png");
|
|
||||||
cv::cvtColor(img, img_rgba, CV_BGR2BGRA);
|
|
||||||
cv::cvtColor(img, img_gray, CV_BGR2GRAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TearDownTestCase()
|
|
||||||
{
|
|
||||||
img_rgba.release();
|
|
||||||
img_gray.release();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
cv::Mat FilterTest::img_rgba;
|
|
||||||
cv::Mat FilterTest::img_gray;
|
|
||||||
|
|
||||||
static double checkNorm(const cv::Mat& m1, const cv::Mat& m2, const cv::Size& ksize)
|
|
||||||
{
|
{
|
||||||
cv::Rect roi(ksize.width, ksize.height, m1.cols - 2 * ksize.width, m1.rows - 2 * ksize.height);
|
cv::Rect roi(ksize.width, ksize.height, m1.cols - 2 * ksize.width, m1.rows - 2 * ksize.height);
|
||||||
cv::Mat m1ROI = m1(roi);
|
cv::Mat m1ROI = m1(roi);
|
||||||
cv::Mat m2ROI = m2(roi);
|
cv::Mat m2ROI = m2(roi);
|
||||||
return checkNorm(m1ROI, m2ROI);
|
return ::checkNorm(m1ROI, m2ROI);
|
||||||
}
|
}
|
||||||
|
|
||||||
static double checkNorm(const cv::Mat& m1, const cv::Mat& m2, int ksize)
|
double checkNorm(const cv::Mat& m1, const cv::Mat& m2, int ksize)
|
||||||
{
|
{
|
||||||
return checkNorm(m1, m2, cv::Size(ksize, ksize));
|
return checkNorm(m1, m2, cv::Size(ksize, ksize));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define EXPECT_MAT_NEAR_KSIZE(mat1, mat2, ksize, eps) \
|
#define EXPECT_MAT_NEAR_KSIZE(mat1, mat2, ksize, eps) \
|
||||||
{ \
|
{ \
|
||||||
@@ -88,17 +69,17 @@ static double checkNorm(const cv::Mat& m1, const cv::Mat& m2, int ksize)
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// blur
|
// blur
|
||||||
|
|
||||||
struct Blur : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int, int> >
|
struct Blur : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int, int> >
|
||||||
{
|
{
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
cv::Size ksize;
|
cv::Size ksize;
|
||||||
|
|
||||||
|
cv::Mat img_rgba;
|
||||||
|
cv::Mat img_gray;
|
||||||
|
|
||||||
cv::Mat dst_gold_rgba;
|
cv::Mat dst_gold_rgba;
|
||||||
cv::Mat dst_gold_gray;
|
cv::Mat dst_gold_gray;
|
||||||
|
|
||||||
using FilterTest::SetUpTestCase;
|
|
||||||
using FilterTest::TearDownTestCase;
|
|
||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
devInfo = std::tr1::get<0>(GetParam());
|
devInfo = std::tr1::get<0>(GetParam());
|
||||||
@@ -106,6 +87,12 @@ struct Blur : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::Devic
|
|||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobp/aloe-L.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
cv::cvtColor(img, img_rgba, CV_BGR2BGRA);
|
||||||
|
cv::cvtColor(img, img_gray, CV_BGR2GRAY);
|
||||||
|
|
||||||
cv::blur(img_rgba, dst_gold_rgba, ksize);
|
cv::blur(img_rgba, dst_gold_rgba, ksize);
|
||||||
cv::blur(img_gray, dst_gold_gray, ksize);
|
cv::blur(img_gray, dst_gold_gray, ksize);
|
||||||
}
|
}
|
||||||
@@ -113,8 +100,6 @@ struct Blur : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::Devic
|
|||||||
|
|
||||||
TEST_P(Blur, Accuracy)
|
TEST_P(Blur, Accuracy)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img_rgba.empty() && !img_gray.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_PARAM(ksize);
|
PRINT_PARAM(ksize);
|
||||||
|
|
||||||
@@ -144,18 +129,18 @@ INSTANTIATE_TEST_CASE_P(Filter, Blur, testing::Combine(
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// sobel
|
// sobel
|
||||||
|
|
||||||
struct Sobel : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int, std::pair<int, int> > >
|
struct Sobel : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int, std::pair<int, int> > >
|
||||||
{
|
{
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
int ksize;
|
int ksize;
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
|
|
||||||
|
cv::Mat img_rgba;
|
||||||
|
cv::Mat img_gray;
|
||||||
|
|
||||||
cv::Mat dst_gold_rgba;
|
cv::Mat dst_gold_rgba;
|
||||||
cv::Mat dst_gold_gray;
|
cv::Mat dst_gold_gray;
|
||||||
|
|
||||||
using FilterTest::SetUpTestCase;
|
|
||||||
using FilterTest::TearDownTestCase;
|
|
||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
devInfo = std::tr1::get<0>(GetParam());
|
devInfo = std::tr1::get<0>(GetParam());
|
||||||
@@ -165,6 +150,12 @@ struct Sobel : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::Devi
|
|||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobp/aloe-L.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
cv::cvtColor(img, img_rgba, CV_BGR2BGRA);
|
||||||
|
cv::cvtColor(img, img_gray, CV_BGR2GRAY);
|
||||||
|
|
||||||
cv::Sobel(img_rgba, dst_gold_rgba, -1, dx, dy, ksize);
|
cv::Sobel(img_rgba, dst_gold_rgba, -1, dx, dy, ksize);
|
||||||
cv::Sobel(img_gray, dst_gold_gray, -1, dx, dy, ksize);
|
cv::Sobel(img_gray, dst_gold_gray, -1, dx, dy, ksize);
|
||||||
}
|
}
|
||||||
@@ -172,8 +163,6 @@ struct Sobel : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::Devi
|
|||||||
|
|
||||||
TEST_P(Sobel, Accuracy)
|
TEST_P(Sobel, Accuracy)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img_rgba.empty() && !img_gray.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_PARAM(ksize);
|
PRINT_PARAM(ksize);
|
||||||
PRINT_PARAM(dx);
|
PRINT_PARAM(dx);
|
||||||
@@ -205,17 +194,17 @@ INSTANTIATE_TEST_CASE_P(Filter, Sobel, testing::Combine(
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// scharr
|
// scharr
|
||||||
|
|
||||||
struct Scharr : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, std::pair<int, int> > >
|
struct Scharr : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, std::pair<int, int> > >
|
||||||
{
|
{
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
|
|
||||||
|
cv::Mat img_rgba;
|
||||||
|
cv::Mat img_gray;
|
||||||
|
|
||||||
cv::Mat dst_gold_rgba;
|
cv::Mat dst_gold_rgba;
|
||||||
cv::Mat dst_gold_gray;
|
cv::Mat dst_gold_gray;
|
||||||
|
|
||||||
using FilterTest::SetUpTestCase;
|
|
||||||
using FilterTest::TearDownTestCase;
|
|
||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
devInfo = std::tr1::get<0>(GetParam());
|
devInfo = std::tr1::get<0>(GetParam());
|
||||||
@@ -224,6 +213,12 @@ struct Scharr : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::Dev
|
|||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobp/aloe-L.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
cv::cvtColor(img, img_rgba, CV_BGR2BGRA);
|
||||||
|
cv::cvtColor(img, img_gray, CV_BGR2GRAY);
|
||||||
|
|
||||||
cv::Scharr(img_rgba, dst_gold_rgba, -1, dx, dy);
|
cv::Scharr(img_rgba, dst_gold_rgba, -1, dx, dy);
|
||||||
cv::Scharr(img_gray, dst_gold_gray, -1, dx, dy);
|
cv::Scharr(img_gray, dst_gold_gray, -1, dx, dy);
|
||||||
}
|
}
|
||||||
@@ -231,8 +226,6 @@ struct Scharr : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::Dev
|
|||||||
|
|
||||||
TEST_P(Scharr, Accuracy)
|
TEST_P(Scharr, Accuracy)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img_rgba.empty() && !img_gray.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_PARAM(dx);
|
PRINT_PARAM(dx);
|
||||||
PRINT_PARAM(dy);
|
PRINT_PARAM(dy);
|
||||||
@@ -262,19 +255,19 @@ INSTANTIATE_TEST_CASE_P(Filter, Scharr, testing::Combine(
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// gaussianBlur
|
// gaussianBlur
|
||||||
|
|
||||||
struct GaussianBlur : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int, int> >
|
struct GaussianBlur : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int, int> >
|
||||||
{
|
{
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
cv::Size ksize;
|
cv::Size ksize;
|
||||||
|
|
||||||
|
cv::Mat img_rgba;
|
||||||
|
cv::Mat img_gray;
|
||||||
|
|
||||||
double sigma1, sigma2;
|
double sigma1, sigma2;
|
||||||
|
|
||||||
cv::Mat dst_gold_rgba;
|
cv::Mat dst_gold_rgba;
|
||||||
cv::Mat dst_gold_gray;
|
cv::Mat dst_gold_gray;
|
||||||
|
|
||||||
using FilterTest::SetUpTestCase;
|
|
||||||
using FilterTest::TearDownTestCase;
|
|
||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
devInfo = std::tr1::get<0>(GetParam());
|
devInfo = std::tr1::get<0>(GetParam());
|
||||||
@@ -282,6 +275,12 @@ struct GaussianBlur : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gp
|
|||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobp/aloe-L.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
cv::cvtColor(img, img_rgba, CV_BGR2BGRA);
|
||||||
|
cv::cvtColor(img, img_gray, CV_BGR2GRAY);
|
||||||
|
|
||||||
cv::RNG& rng = cvtest::TS::ptr()->get_rng();
|
cv::RNG& rng = cvtest::TS::ptr()->get_rng();
|
||||||
|
|
||||||
sigma1 = rng.uniform(0.1, 1.0);
|
sigma1 = rng.uniform(0.1, 1.0);
|
||||||
@@ -294,8 +293,6 @@ struct GaussianBlur : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gp
|
|||||||
|
|
||||||
TEST_P(GaussianBlur, Accuracy)
|
TEST_P(GaussianBlur, Accuracy)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img_rgba.empty() && !img_gray.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_PARAM(ksize);
|
PRINT_PARAM(ksize);
|
||||||
PRINT_PARAM(sigma1);
|
PRINT_PARAM(sigma1);
|
||||||
@@ -327,17 +324,17 @@ INSTANTIATE_TEST_CASE_P(Filter, GaussianBlur, testing::Combine(
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// laplacian
|
// laplacian
|
||||||
|
|
||||||
struct Laplacian : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int> >
|
struct Laplacian : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int> >
|
||||||
{
|
{
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
int ksize;
|
int ksize;
|
||||||
|
|
||||||
|
cv::Mat img_rgba;
|
||||||
|
cv::Mat img_gray;
|
||||||
|
|
||||||
cv::Mat dst_gold_rgba;
|
cv::Mat dst_gold_rgba;
|
||||||
cv::Mat dst_gold_gray;
|
cv::Mat dst_gold_gray;
|
||||||
|
|
||||||
using FilterTest::SetUpTestCase;
|
|
||||||
using FilterTest::TearDownTestCase;
|
|
||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
devInfo = std::tr1::get<0>(GetParam());
|
devInfo = std::tr1::get<0>(GetParam());
|
||||||
@@ -345,6 +342,12 @@ struct Laplacian : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::
|
|||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobp/aloe-L.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
cv::cvtColor(img, img_rgba, CV_BGR2BGRA);
|
||||||
|
cv::cvtColor(img, img_gray, CV_BGR2GRAY);
|
||||||
|
|
||||||
cv::Laplacian(img_rgba, dst_gold_rgba, -1, ksize);
|
cv::Laplacian(img_rgba, dst_gold_rgba, -1, ksize);
|
||||||
cv::Laplacian(img_gray, dst_gold_gray, -1, ksize);
|
cv::Laplacian(img_gray, dst_gold_gray, -1, ksize);
|
||||||
}
|
}
|
||||||
@@ -352,8 +355,6 @@ struct Laplacian : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::
|
|||||||
|
|
||||||
TEST_P(Laplacian, Accuracy)
|
TEST_P(Laplacian, Accuracy)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img_rgba.empty() && !img_gray.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_PARAM(ksize);
|
PRINT_PARAM(ksize);
|
||||||
|
|
||||||
@@ -382,18 +383,18 @@ INSTANTIATE_TEST_CASE_P(Filter, Laplacian, testing::Combine(
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// erode
|
// erode
|
||||||
|
|
||||||
struct Erode : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
|
struct Erode : testing::TestWithParam<cv::gpu::DeviceInfo>
|
||||||
{
|
{
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
|
|
||||||
|
cv::Mat img_rgba;
|
||||||
|
cv::Mat img_gray;
|
||||||
|
|
||||||
cv::Mat kernel;
|
cv::Mat kernel;
|
||||||
|
|
||||||
cv::Mat dst_gold_rgba;
|
cv::Mat dst_gold_rgba;
|
||||||
cv::Mat dst_gold_gray;
|
cv::Mat dst_gold_gray;
|
||||||
|
|
||||||
using FilterTest::SetUpTestCase;
|
|
||||||
using FilterTest::TearDownTestCase;
|
|
||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
devInfo = GetParam();
|
devInfo = GetParam();
|
||||||
@@ -402,6 +403,12 @@ struct Erode : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
|
|
||||||
kernel = cv::Mat::ones(3, 3, CV_8U);
|
kernel = cv::Mat::ones(3, 3, CV_8U);
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobp/aloe-L.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
cv::cvtColor(img, img_rgba, CV_BGR2BGRA);
|
||||||
|
cv::cvtColor(img, img_gray, CV_BGR2GRAY);
|
||||||
|
|
||||||
cv::erode(img_rgba, dst_gold_rgba, kernel);
|
cv::erode(img_rgba, dst_gold_rgba, kernel);
|
||||||
cv::erode(img_gray, dst_gold_gray, kernel);
|
cv::erode(img_gray, dst_gold_gray, kernel);
|
||||||
}
|
}
|
||||||
@@ -409,8 +416,6 @@ struct Erode : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
|
|
||||||
TEST_P(Erode, Accuracy)
|
TEST_P(Erode, Accuracy)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img_rgba.empty() && !img_gray.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
|
|
||||||
cv::Mat dst_rgba;
|
cv::Mat dst_rgba;
|
||||||
@@ -436,18 +441,18 @@ INSTANTIATE_TEST_CASE_P(Filter, Erode, testing::ValuesIn(devices()));
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// dilate
|
// dilate
|
||||||
|
|
||||||
struct Dilate : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
|
struct Dilate : testing::TestWithParam<cv::gpu::DeviceInfo>
|
||||||
{
|
{
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
|
|
||||||
|
cv::Mat img_rgba;
|
||||||
|
cv::Mat img_gray;
|
||||||
|
|
||||||
cv::Mat kernel;
|
cv::Mat kernel;
|
||||||
|
|
||||||
cv::Mat dst_gold_rgba;
|
cv::Mat dst_gold_rgba;
|
||||||
cv::Mat dst_gold_gray;
|
cv::Mat dst_gold_gray;
|
||||||
|
|
||||||
using FilterTest::SetUpTestCase;
|
|
||||||
using FilterTest::TearDownTestCase;
|
|
||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
devInfo = GetParam();
|
devInfo = GetParam();
|
||||||
@@ -456,6 +461,12 @@ struct Dilate : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
|
|
||||||
kernel = cv::Mat::ones(3, 3, CV_8U);
|
kernel = cv::Mat::ones(3, 3, CV_8U);
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobp/aloe-L.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
cv::cvtColor(img, img_rgba, CV_BGR2BGRA);
|
||||||
|
cv::cvtColor(img, img_gray, CV_BGR2GRAY);
|
||||||
|
|
||||||
cv::dilate(img_rgba, dst_gold_rgba, kernel);
|
cv::dilate(img_rgba, dst_gold_rgba, kernel);
|
||||||
cv::dilate(img_gray, dst_gold_gray, kernel);
|
cv::dilate(img_gray, dst_gold_gray, kernel);
|
||||||
}
|
}
|
||||||
@@ -463,8 +474,6 @@ struct Dilate : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
|
|
||||||
TEST_P(Dilate, Accuracy)
|
TEST_P(Dilate, Accuracy)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img_rgba.empty() && !img_gray.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
|
|
||||||
cv::Mat dst_rgba;
|
cv::Mat dst_rgba;
|
||||||
@@ -493,19 +502,19 @@ INSTANTIATE_TEST_CASE_P(Filter, Dilate, testing::ValuesIn(devices()));
|
|||||||
static const int morphOps[] = {cv::MORPH_OPEN, CV_MOP_CLOSE, CV_MOP_GRADIENT, CV_MOP_TOPHAT, CV_MOP_BLACKHAT};
|
static const int morphOps[] = {cv::MORPH_OPEN, CV_MOP_CLOSE, CV_MOP_GRADIENT, CV_MOP_TOPHAT, CV_MOP_BLACKHAT};
|
||||||
static const char* morphOps_str[] = {"MORPH_OPEN", "MOP_CLOSE", "MOP_GRADIENT", "MOP_TOPHAT", "MOP_BLACKHAT"};
|
static const char* morphOps_str[] = {"MORPH_OPEN", "MOP_CLOSE", "MOP_GRADIENT", "MOP_TOPHAT", "MOP_BLACKHAT"};
|
||||||
|
|
||||||
struct MorphEx : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int> >
|
struct MorphEx : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int> >
|
||||||
{
|
{
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
int morphOpsIdx;
|
int morphOpsIdx;
|
||||||
|
|
||||||
|
cv::Mat img_rgba;
|
||||||
|
cv::Mat img_gray;
|
||||||
|
|
||||||
cv::Mat kernel;
|
cv::Mat kernel;
|
||||||
|
|
||||||
cv::Mat dst_gold_rgba;
|
cv::Mat dst_gold_rgba;
|
||||||
cv::Mat dst_gold_gray;
|
cv::Mat dst_gold_gray;
|
||||||
|
|
||||||
using FilterTest::SetUpTestCase;
|
|
||||||
using FilterTest::TearDownTestCase;
|
|
||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
devInfo = std::tr1::get<0>(GetParam());
|
devInfo = std::tr1::get<0>(GetParam());
|
||||||
@@ -513,6 +522,12 @@ struct MorphEx : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::De
|
|||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobp/aloe-L.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
cv::cvtColor(img, img_rgba, CV_BGR2BGRA);
|
||||||
|
cv::cvtColor(img, img_gray, CV_BGR2GRAY);
|
||||||
|
|
||||||
kernel = cv::Mat::ones(3, 3, CV_8U);
|
kernel = cv::Mat::ones(3, 3, CV_8U);
|
||||||
|
|
||||||
cv::morphologyEx(img_rgba, dst_gold_rgba, morphOps[morphOpsIdx], kernel);
|
cv::morphologyEx(img_rgba, dst_gold_rgba, morphOps[morphOpsIdx], kernel);
|
||||||
@@ -522,8 +537,6 @@ struct MorphEx : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::De
|
|||||||
|
|
||||||
TEST_P(MorphEx, Accuracy)
|
TEST_P(MorphEx, Accuracy)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img_rgba.empty() && !img_gray.empty());
|
|
||||||
|
|
||||||
const char* morphOpStr = morphOps_str[morphOpsIdx];
|
const char* morphOpStr = morphOps_str[morphOpsIdx];
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
|
@@ -50,7 +50,7 @@ struct CV_GpuHogDetectTestRunner : cv::gpu::HOGDescriptor
|
|||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
cv::Mat img_rgb = readImage("hog/road.png");
|
cv::Mat img_rgb = readImage("hog/road.png");
|
||||||
ASSERT_TRUE(!img_rgb.empty());
|
ASSERT_FALSE(img_rgb.empty());
|
||||||
|
|
||||||
#ifdef DUMP
|
#ifdef DUMP
|
||||||
f.open((std::string(cvtest::TS::ptr()->get_data_path()) + "hog/expected_output.bin").c_str(), std::ios_base::binary);
|
f.open((std::string(cvtest::TS::ptr()->get_data_path()) + "hog/expected_output.bin").c_str(), std::ios_base::binary);
|
||||||
@@ -201,7 +201,7 @@ struct CV_GpuHogGetDescriptorsTestRunner : cv::gpu::HOGDescriptor
|
|||||||
{
|
{
|
||||||
// Load image (e.g. train data, composed from windows)
|
// Load image (e.g. train data, composed from windows)
|
||||||
cv::Mat img_rgb = readImage("hog/train_data.png");
|
cv::Mat img_rgb = readImage("hog/train_data.png");
|
||||||
ASSERT_TRUE(!img_rgb.empty());
|
ASSERT_FALSE(img_rgb.empty());
|
||||||
|
|
||||||
// Convert to C4
|
// Convert to C4
|
||||||
cv::Mat img;
|
cv::Mat img;
|
||||||
|
@@ -441,18 +441,6 @@ INSTANTIATE_TEST_CASE_P(ImgProc, Integral, testing::ValuesIn(devices()));
|
|||||||
|
|
||||||
struct CvtColor : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int> >
|
struct CvtColor : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int> >
|
||||||
{
|
{
|
||||||
static cv::Mat imgBase;
|
|
||||||
|
|
||||||
static void SetUpTestCase()
|
|
||||||
{
|
|
||||||
imgBase = readImage("stereobm/aloe-L.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TearDownTestCase()
|
|
||||||
{
|
|
||||||
imgBase.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
@@ -465,16 +453,15 @@ struct CvtColor : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, i
|
|||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::Mat imgBase = readImage("stereobm/aloe-L.png");
|
||||||
|
ASSERT_FALSE(imgBase.empty());
|
||||||
|
|
||||||
imgBase.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
|
imgBase.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
cv::Mat CvtColor::imgBase;
|
|
||||||
|
|
||||||
TEST_P(CvtColor, BGR2RGB)
|
TEST_P(CvtColor, BGR2RGB)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -497,8 +484,6 @@ TEST_P(CvtColor, BGR2RGB)
|
|||||||
|
|
||||||
TEST_P(CvtColor, BGR2RGBA)
|
TEST_P(CvtColor, BGR2RGBA)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -521,8 +506,6 @@ TEST_P(CvtColor, BGR2RGBA)
|
|||||||
|
|
||||||
TEST_P(CvtColor, BGRA2RGB)
|
TEST_P(CvtColor, BGRA2RGB)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -546,8 +529,6 @@ TEST_P(CvtColor, BGRA2RGB)
|
|||||||
|
|
||||||
TEST_P(CvtColor, BGR2YCrCb)
|
TEST_P(CvtColor, BGR2YCrCb)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -570,8 +551,6 @@ TEST_P(CvtColor, BGR2YCrCb)
|
|||||||
|
|
||||||
TEST_P(CvtColor, YCrCb2RGB)
|
TEST_P(CvtColor, YCrCb2RGB)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -595,8 +574,6 @@ TEST_P(CvtColor, YCrCb2RGB)
|
|||||||
|
|
||||||
TEST_P(CvtColor, BGR2YUV)
|
TEST_P(CvtColor, BGR2YUV)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -619,8 +596,6 @@ TEST_P(CvtColor, BGR2YUV)
|
|||||||
|
|
||||||
TEST_P(CvtColor, YUV2BGR)
|
TEST_P(CvtColor, YUV2BGR)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -644,8 +619,6 @@ TEST_P(CvtColor, YUV2BGR)
|
|||||||
|
|
||||||
TEST_P(CvtColor, BGR2XYZ)
|
TEST_P(CvtColor, BGR2XYZ)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -668,8 +641,6 @@ TEST_P(CvtColor, BGR2XYZ)
|
|||||||
|
|
||||||
TEST_P(CvtColor, XYZ2BGR)
|
TEST_P(CvtColor, XYZ2BGR)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -696,8 +667,6 @@ TEST_P(CvtColor, BGR2HSV)
|
|||||||
if (type == CV_16U)
|
if (type == CV_16U)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -723,8 +692,6 @@ TEST_P(CvtColor, HSV2BGR)
|
|||||||
if (type == CV_16U)
|
if (type == CV_16U)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -751,8 +718,6 @@ TEST_P(CvtColor, BGR2HSV_FULL)
|
|||||||
if (type == CV_16U)
|
if (type == CV_16U)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -778,8 +743,6 @@ TEST_P(CvtColor, HSV2BGR_FULL)
|
|||||||
if (type == CV_16U)
|
if (type == CV_16U)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -806,8 +769,6 @@ TEST_P(CvtColor, BGR2HLS)
|
|||||||
if (type == CV_16U)
|
if (type == CV_16U)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -833,8 +794,6 @@ TEST_P(CvtColor, HLS2BGR)
|
|||||||
if (type == CV_16U)
|
if (type == CV_16U)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -861,8 +820,6 @@ TEST_P(CvtColor, BGR2HLS_FULL)
|
|||||||
if (type == CV_16U)
|
if (type == CV_16U)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -888,8 +845,6 @@ TEST_P(CvtColor, HLS2BGR_FULL)
|
|||||||
if (type == CV_16U)
|
if (type == CV_16U)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -913,8 +868,6 @@ TEST_P(CvtColor, HLS2BGR_FULL)
|
|||||||
|
|
||||||
TEST_P(CvtColor, BGR2GRAY)
|
TEST_P(CvtColor, BGR2GRAY)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -937,8 +890,6 @@ TEST_P(CvtColor, BGR2GRAY)
|
|||||||
|
|
||||||
TEST_P(CvtColor, GRAY2RGB)
|
TEST_P(CvtColor, GRAY2RGB)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!img.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_TYPE(type);
|
PRINT_TYPE(type);
|
||||||
|
|
||||||
@@ -969,21 +920,10 @@ INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor, testing::Combine(
|
|||||||
|
|
||||||
struct HistEven : testing::TestWithParam<cv::gpu::DeviceInfo>
|
struct HistEven : testing::TestWithParam<cv::gpu::DeviceInfo>
|
||||||
{
|
{
|
||||||
static cv::Mat hsv;
|
|
||||||
|
|
||||||
static void SetUpTestCase()
|
|
||||||
{
|
|
||||||
cv::Mat img = readImage("stereobm/aloe-L.png");
|
|
||||||
cv::cvtColor(img, hsv, CV_BGR2HSV);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TearDownTestCase()
|
|
||||||
{
|
|
||||||
hsv.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
|
|
||||||
|
cv::Mat hsv;
|
||||||
|
|
||||||
int hbins;
|
int hbins;
|
||||||
float hranges[2];
|
float hranges[2];
|
||||||
|
|
||||||
@@ -995,6 +935,11 @@ struct HistEven : testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobm/aloe-L.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
cv::cvtColor(img, hsv, CV_BGR2HSV);
|
||||||
|
|
||||||
hbins = 30;
|
hbins = 30;
|
||||||
|
|
||||||
hranges[0] = 0;
|
hranges[0] = 0;
|
||||||
@@ -1014,8 +959,6 @@ struct HistEven : testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
cv::Mat HistEven::hsv;
|
|
||||||
|
|
||||||
TEST_P(HistEven, Accuracy)
|
TEST_P(HistEven, Accuracy)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!hsv.empty());
|
ASSERT_TRUE(!hsv.empty());
|
||||||
@@ -1146,18 +1089,6 @@ static const char* borderTypes_str[] = {"BORDER_REPLICATE", "BORDER_CONSTANT", "
|
|||||||
|
|
||||||
struct CornerHarris : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int, int> >
|
struct CornerHarris : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int, int> >
|
||||||
{
|
{
|
||||||
static cv::Mat img;
|
|
||||||
|
|
||||||
static void SetUpTestCase()
|
|
||||||
{
|
|
||||||
img = readImage("stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TearDownTestCase()
|
|
||||||
{
|
|
||||||
img.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
int type;
|
int type;
|
||||||
int borderTypeIdx;
|
int borderTypeIdx;
|
||||||
@@ -1179,6 +1110,9 @@ struct CornerHarris : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInf
|
|||||||
|
|
||||||
cv::RNG& rng = cvtest::TS::ptr()->get_rng();
|
cv::RNG& rng = cvtest::TS::ptr()->get_rng();
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
img.convertTo(src, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
|
img.convertTo(src, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
|
||||||
|
|
||||||
blockSize = 1 + rng.next() % 5;
|
blockSize = 1 + rng.next() % 5;
|
||||||
@@ -1189,8 +1123,6 @@ struct CornerHarris : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInf
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
cv::Mat CornerHarris::img;
|
|
||||||
|
|
||||||
TEST_P(CornerHarris, Accuracy)
|
TEST_P(CornerHarris, Accuracy)
|
||||||
{
|
{
|
||||||
const char* borderTypeStr = borderTypes_str[borderTypeIdx];
|
const char* borderTypeStr = borderTypes_str[borderTypeIdx];
|
||||||
@@ -1222,18 +1154,6 @@ INSTANTIATE_TEST_CASE_P(ImgProc, CornerHarris, testing::Combine(
|
|||||||
|
|
||||||
struct CornerMinEigen : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int, int> >
|
struct CornerMinEigen : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int, int> >
|
||||||
{
|
{
|
||||||
static cv::Mat img;
|
|
||||||
|
|
||||||
static void SetUpTestCase()
|
|
||||||
{
|
|
||||||
img = readImage("stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TearDownTestCase()
|
|
||||||
{
|
|
||||||
img.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
int type;
|
int type;
|
||||||
int borderTypeIdx;
|
int borderTypeIdx;
|
||||||
@@ -1254,6 +1174,9 @@ struct CornerMinEigen : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceI
|
|||||||
|
|
||||||
cv::RNG& rng = cvtest::TS::ptr()->get_rng();
|
cv::RNG& rng = cvtest::TS::ptr()->get_rng();
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
img.convertTo(src, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
|
img.convertTo(src, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
|
||||||
|
|
||||||
blockSize = 1 + rng.next() % 5;
|
blockSize = 1 + rng.next() % 5;
|
||||||
@@ -1263,8 +1186,6 @@ struct CornerMinEigen : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceI
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
cv::Mat CornerMinEigen::img;
|
|
||||||
|
|
||||||
TEST_P(CornerMinEigen, Accuracy)
|
TEST_P(CornerMinEigen, Accuracy)
|
||||||
{
|
{
|
||||||
const char* borderTypeStr = borderTypes_str[borderTypeIdx];
|
const char* borderTypeStr = borderTypes_str[borderTypeIdx];
|
||||||
@@ -1475,21 +1396,10 @@ INSTANTIATE_TEST_CASE_P(ImgProc, ReprojectImageTo3D, testing::ValuesIn(devices()
|
|||||||
|
|
||||||
struct MeanShift : testing::TestWithParam<cv::gpu::DeviceInfo>
|
struct MeanShift : testing::TestWithParam<cv::gpu::DeviceInfo>
|
||||||
{
|
{
|
||||||
static cv::Mat rgba;
|
|
||||||
|
|
||||||
static void SetUpTestCase()
|
|
||||||
{
|
|
||||||
cv::Mat img = readImage("meanshift/cones.png");
|
|
||||||
cv::cvtColor(img, rgba, CV_BGR2BGRA);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TearDownTestCase()
|
|
||||||
{
|
|
||||||
rgba.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
|
|
||||||
|
cv::Mat rgba;
|
||||||
|
|
||||||
int spatialRad;
|
int spatialRad;
|
||||||
int colorRad;
|
int colorRad;
|
||||||
|
|
||||||
@@ -1499,13 +1409,16 @@ struct MeanShift : testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::Mat img = readImage("meanshift/cones.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
cv::cvtColor(img, rgba, CV_BGR2BGRA);
|
||||||
|
|
||||||
spatialRad = 30;
|
spatialRad = 30;
|
||||||
colorRad = 30;
|
colorRad = 30;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
cv::Mat MeanShift::rgba;
|
|
||||||
|
|
||||||
TEST_P(MeanShift, Filtering)
|
TEST_P(MeanShift, Filtering)
|
||||||
{
|
{
|
||||||
cv::Mat img_template;
|
cv::Mat img_template;
|
||||||
@@ -1515,7 +1428,7 @@ TEST_P(MeanShift, Filtering)
|
|||||||
else
|
else
|
||||||
img_template = readImage("meanshift/con_result_CC1X.png");
|
img_template = readImage("meanshift/con_result_CC1X.png");
|
||||||
|
|
||||||
ASSERT_TRUE(!rgba.empty() && !img_template.empty());
|
ASSERT_FALSE(img_template.empty());
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
|
|
||||||
@@ -1580,22 +1493,11 @@ INSTANTIATE_TEST_CASE_P(ImgProc, MeanShift, testing::ValuesIn(devices()));
|
|||||||
|
|
||||||
struct MeanShiftSegmentation : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int> >
|
struct MeanShiftSegmentation : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int> >
|
||||||
{
|
{
|
||||||
static cv::Mat rgba;
|
|
||||||
|
|
||||||
static void SetUpTestCase()
|
|
||||||
{
|
|
||||||
cv::Mat img = readImage("meanshift/cones.png");
|
|
||||||
cv::cvtColor(img, rgba, CV_BGR2BGRA);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TearDownTestCase()
|
|
||||||
{
|
|
||||||
rgba.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
int minsize;
|
int minsize;
|
||||||
|
|
||||||
|
cv::Mat rgba;
|
||||||
|
|
||||||
cv::Mat dst_gold;
|
cv::Mat dst_gold;
|
||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
@@ -1605,6 +1507,11 @@ struct MeanShiftSegmentation : testing::TestWithParam< std::tr1::tuple<cv::gpu::
|
|||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::Mat img = readImage("meanshift/cones.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
cv::cvtColor(img, rgba, CV_BGR2BGRA);
|
||||||
|
|
||||||
std::ostringstream path;
|
std::ostringstream path;
|
||||||
path << "meanshift/cones_segmented_sp10_sr10_minsize" << minsize;
|
path << "meanshift/cones_segmented_sp10_sr10_minsize" << minsize;
|
||||||
if (supportFeature(devInfo, cv::gpu::FEATURE_SET_COMPUTE_20))
|
if (supportFeature(devInfo, cv::gpu::FEATURE_SET_COMPUTE_20))
|
||||||
@@ -1613,15 +1520,12 @@ struct MeanShiftSegmentation : testing::TestWithParam< std::tr1::tuple<cv::gpu::
|
|||||||
path << "_CC1X.png";
|
path << "_CC1X.png";
|
||||||
|
|
||||||
dst_gold = readImage(path.str());
|
dst_gold = readImage(path.str());
|
||||||
|
ASSERT_FALSE(dst_gold.empty());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
cv::Mat MeanShiftSegmentation::rgba;
|
|
||||||
|
|
||||||
TEST_P(MeanShiftSegmentation, Regression)
|
TEST_P(MeanShiftSegmentation, Regression)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!rgba.empty() && !dst_gold.empty());
|
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
PRINT_PARAM(minsize);
|
PRINT_PARAM(minsize);
|
||||||
|
|
||||||
@@ -1768,24 +1672,10 @@ INSTANTIATE_TEST_CASE_P(ImgProc, MatchTemplate32F, testing::Combine(
|
|||||||
|
|
||||||
struct MatchTemplate : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int> >
|
struct MatchTemplate : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int> >
|
||||||
{
|
{
|
||||||
static cv::Mat image;
|
cv::Mat image;
|
||||||
static cv::Mat pattern;
|
cv::Mat pattern;
|
||||||
|
|
||||||
static cv::Point maxLocGold;
|
cv::Point maxLocGold;
|
||||||
|
|
||||||
static void SetUpTestCase()
|
|
||||||
{
|
|
||||||
image = readImage("matchtemplate/black.png");
|
|
||||||
pattern = readImage("matchtemplate/cat.png");
|
|
||||||
|
|
||||||
maxLocGold = cv::Point(284, 12);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TearDownTestCase()
|
|
||||||
{
|
|
||||||
image.release();
|
|
||||||
pattern.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
int method;
|
int method;
|
||||||
@@ -1796,17 +1686,19 @@ struct MatchTemplate : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceIn
|
|||||||
method = std::tr1::get<1>(GetParam());
|
method = std::tr1::get<1>(GetParam());
|
||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
image = readImage("matchtemplate/black.png");
|
||||||
|
ASSERT_FALSE(image.empty());
|
||||||
|
|
||||||
|
pattern = readImage("matchtemplate/cat.png");
|
||||||
|
ASSERT_FALSE(pattern.empty());
|
||||||
|
|
||||||
|
maxLocGold = cv::Point(284, 12);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
cv::Mat MatchTemplate::image;
|
|
||||||
cv::Mat MatchTemplate::pattern;
|
|
||||||
cv::Point MatchTemplate::maxLocGold;
|
|
||||||
|
|
||||||
TEST_P(MatchTemplate, FindPatternInBlack)
|
TEST_P(MatchTemplate, FindPatternInBlack)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(!image.empty() && !pattern.empty());
|
|
||||||
|
|
||||||
const char* matchTemplateMethodStr = matchTemplateMethods[method];
|
const char* matchTemplateMethodStr = matchTemplateMethods[method];
|
||||||
|
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
@@ -1919,6 +1811,7 @@ struct Dft : testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void testC2C(const std::string& hint, int cols, int rows, int flags, bool inplace)
|
static void testC2C(const std::string& hint, int cols, int rows, int flags, bool inplace)
|
||||||
{
|
{
|
||||||
PRINT_PARAM(hint);
|
PRINT_PARAM(hint);
|
||||||
@@ -2146,10 +2039,21 @@ struct PyrDown : testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
{
|
{
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
|
|
||||||
|
cv::Mat src;
|
||||||
|
|
||||||
|
cv::Mat dst_gold;
|
||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
devInfo = GetParam();
|
devInfo = GetParam();
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobm/aloe-L.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
img.convertTo(src, CV_16S);
|
||||||
|
|
||||||
|
cv::pyrDown(src, dst_gold);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2157,22 +2061,22 @@ TEST_P(PyrDown, Accuracy)
|
|||||||
{
|
{
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
|
|
||||||
cv::Mat src;
|
cv::Mat dst;
|
||||||
readImage("stereobm/aloe-L.png").convertTo(src, CV_16S);
|
|
||||||
|
|
||||||
cv::Mat dst_gold;
|
|
||||||
cv::pyrDown(src, dst_gold);
|
|
||||||
|
|
||||||
|
ASSERT_NO_THROW(
|
||||||
cv::gpu::GpuMat d_dst;
|
cv::gpu::GpuMat d_dst;
|
||||||
|
|
||||||
cv::gpu::pyrDown(cv::gpu::GpuMat(src), d_dst);
|
cv::gpu::pyrDown(cv::gpu::GpuMat(src), d_dst);
|
||||||
cv::Mat dst_mine = d_dst;
|
|
||||||
|
|
||||||
ASSERT_EQ(dst_gold.cols, dst_mine.cols);
|
d_dst.download(dst);
|
||||||
ASSERT_EQ(dst_gold.rows, dst_mine.rows);
|
);
|
||||||
ASSERT_EQ(dst_gold.type(), dst_mine.type());
|
|
||||||
|
|
||||||
double err = cvtest::crossCorr(dst_gold, dst_mine) /
|
ASSERT_EQ(dst_gold.cols, dst.cols);
|
||||||
(cv::norm(dst_gold,cv::NORM_L2)*cv::norm(dst_mine,cv::NORM_L2));
|
ASSERT_EQ(dst_gold.rows, dst.rows);
|
||||||
|
ASSERT_EQ(dst_gold.type(), dst.type());
|
||||||
|
|
||||||
|
double err = cvtest::crossCorr(dst_gold, dst) /
|
||||||
|
(cv::norm(dst_gold,cv::NORM_L2)*cv::norm(dst,cv::NORM_L2));
|
||||||
ASSERT_NEAR(err, 1., 1e-2);
|
ASSERT_NEAR(err, 1., 1e-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2185,10 +2089,21 @@ struct PyrUp: testing::TestWithParam<cv::gpu::DeviceInfo>
|
|||||||
{
|
{
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
|
|
||||||
|
cv::Mat src;
|
||||||
|
|
||||||
|
cv::Mat dst_gold;
|
||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
devInfo = GetParam();
|
devInfo = GetParam();
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::Mat img = readImage("stereobm/aloe-L.png");
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
|
img.convertTo(src, CV_16S);
|
||||||
|
|
||||||
|
cv::pyrUp(src, dst_gold);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2196,22 +2111,22 @@ TEST_P(PyrUp, Accuracy)
|
|||||||
{
|
{
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
|
|
||||||
cv::Mat src;
|
cv::Mat dst;
|
||||||
readImage("stereobm/aloe-L.png").convertTo(src, CV_16S);
|
|
||||||
|
|
||||||
cv::Mat dst_gold;
|
|
||||||
cv::pyrUp(src, dst_gold);
|
|
||||||
|
|
||||||
|
ASSERT_NO_THROW(
|
||||||
cv::gpu::GpuMat d_dst;
|
cv::gpu::GpuMat d_dst;
|
||||||
|
|
||||||
cv::gpu::pyrUp(cv::gpu::GpuMat(src), d_dst);
|
cv::gpu::pyrUp(cv::gpu::GpuMat(src), d_dst);
|
||||||
cv::Mat dst_mine = d_dst;
|
|
||||||
|
|
||||||
ASSERT_EQ(dst_gold.cols, dst_mine.cols);
|
d_dst.download(dst);
|
||||||
ASSERT_EQ(dst_gold.rows, dst_mine.rows);
|
);
|
||||||
ASSERT_EQ(dst_gold.type(), dst_mine.type());
|
|
||||||
|
|
||||||
double err = cvtest::crossCorr(dst_gold, dst_mine) /
|
ASSERT_EQ(dst_gold.cols, dst.cols);
|
||||||
(cv::norm(dst_gold,cv::NORM_L2)*cv::norm(dst_mine,cv::NORM_L2));
|
ASSERT_EQ(dst_gold.rows, dst.rows);
|
||||||
|
ASSERT_EQ(dst_gold.type(), dst.type());
|
||||||
|
|
||||||
|
double err = cvtest::crossCorr(dst_gold, dst) /
|
||||||
|
(cv::norm(dst_gold,cv::NORM_L2)*cv::norm(dst,cv::NORM_L2));
|
||||||
ASSERT_NEAR(err, 1., 1e-2);
|
ASSERT_NEAR(err, 1., 1e-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2222,22 +2137,12 @@ INSTANTIATE_TEST_CASE_P(ImgProc, PyrUp, testing::ValuesIn(devices()));
|
|||||||
|
|
||||||
struct Canny : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int, bool> >
|
struct Canny : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int, bool> >
|
||||||
{
|
{
|
||||||
static cv::Mat img;
|
|
||||||
|
|
||||||
static void SetUpTestCase()
|
|
||||||
{
|
|
||||||
img = readImage("stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TearDownTestCase()
|
|
||||||
{
|
|
||||||
img.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
cv::gpu::DeviceInfo devInfo;
|
cv::gpu::DeviceInfo devInfo;
|
||||||
int apperture_size;
|
int apperture_size;
|
||||||
bool L2gradient;
|
bool L2gradient;
|
||||||
|
|
||||||
|
cv::Mat img;
|
||||||
|
|
||||||
double low_thresh;
|
double low_thresh;
|
||||||
double high_thresh;
|
double high_thresh;
|
||||||
|
|
||||||
@@ -2251,6 +2156,9 @@ struct Canny : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int,
|
|||||||
|
|
||||||
cv::gpu::setDevice(devInfo.deviceID());
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
img = readImage("stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||||
|
ASSERT_FALSE(img.empty());
|
||||||
|
|
||||||
low_thresh = 50.0;
|
low_thresh = 50.0;
|
||||||
high_thresh = 100.0;
|
high_thresh = 100.0;
|
||||||
|
|
||||||
@@ -2258,8 +2166,6 @@ struct Canny : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
cv::Mat Canny::img;
|
|
||||||
|
|
||||||
TEST_P(Canny, Accuracy)
|
TEST_P(Canny, Accuracy)
|
||||||
{
|
{
|
||||||
PRINT_PARAM(devInfo);
|
PRINT_PARAM(devInfo);
|
||||||
|
Reference in New Issue
Block a user