Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
f4f38fcc
Commit
f4f38fcc
authored
Aug 09, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed gpu test failure on empty test data
parent
a5f38806
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
239 additions
and
333 deletions
+239
-333
test_calib3d.cpp
modules/gpu/test/test_calib3d.cpp
+44
-40
test_features2d.cpp
modules/gpu/test/test_features2d.cpp
+13
-30
test_filters.cpp
modules/gpu/test/test_filters.cpp
+87
-74
test_hog.cpp
modules/gpu/test/test_hog.cpp
+2
-2
test_imgproc.cpp
modules/gpu/test/test_imgproc.cpp
+93
-187
No files found.
modules/gpu/test/test_calib3d.cpp
View file @
f4f38fcc
...
...
@@ -43,18 +43,14 @@
#ifdef HAVE_CUDA
struct
StereoTest
:
testing
::
TestWithParam
<
cv
::
gpu
::
DeviceInfo
>
{
static
cv
::
Mat
img_l
;
static
cv
::
Mat
img_r
;
static
cv
::
Mat
img_template
;
//////////////////////////////////////////////////////////////////////////
// BlockMatching
static
void
TearDownTestCase
()
{
img_l
.
release
();
img_r
.
release
();
img_template
.
release
();
}
struct
StereoBlockMatching
:
testing
::
TestWithParam
<
cv
::
gpu
::
DeviceInfo
>
{
cv
::
Mat
img_l
;
cv
::
Mat
img_r
;
cv
::
Mat
img_template
;
cv
::
gpu
::
DeviceInfo
devInfo
;
...
...
@@ -63,30 +59,19 @@ struct StereoTest : testing::TestWithParam<cv::gpu::DeviceInfo>
devInfo
=
GetParam
();
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_r
=
readImage
(
"stereobm/aloe-R.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
)
{
ASSERT_TRUE
(
!
img_l
.
empty
()
&&
!
img_r
.
empty
()
&&
!
img_template
.
empty
());
PRINT_PARAM
(
devInfo
);
cv
::
Mat
disp
;
...
...
@@ -110,20 +95,32 @@ INSTANTIATE_TEST_CASE_P(Calib3D, StereoBlockMatching, testing::ValuesIn(devices(
//////////////////////////////////////////////////////////////////////////
// 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_r
=
readImage
(
"stereobp/aloe-R.png"
);
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
)
{
ASSERT_TRUE
(
!
img_l
.
empty
()
&&
!
img_r
.
empty
()
&&
!
img_template
.
empty
());
PRINT_PARAM
(
devInfo
);
cv
::
Mat
disp
;
...
...
@@ -147,29 +144,36 @@ INSTANTIATE_TEST_CASE_P(Calib3D, StereoBeliefPropagation, testing::ValuesIn(devi
//////////////////////////////////////////////////////////////////////////
// ConstantSpaceBP
struct
StereoConstantSpaceBP
:
StereoTest
struct
StereoConstantSpaceBP
:
testing
::
TestWithParam
<
cv
::
gpu
::
DeviceInfo
>
{
static
void
SetUpTestCase
()
{
img_l
=
readImage
(
"csstereobp/aloe-L.png"
)
;
img_r
=
readImage
(
"csstereobp/aloe-R.png"
);
}
cv
::
Mat
img_l
;
cv
::
Mat
img_r
;
cv
::
Mat
img_template
;
cv
::
gpu
::
DeviceInfo
devInfo
;
virtual
void
SetUp
()
{
StereoTest
::
SetUp
();
devInfo
=
GetParam
();
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
if
(
supportFeature
(
GetParam
(),
cv
::
gpu
::
FEATURE_SET_COMPUTE_20
))
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
);
else
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
)
{
ASSERT_TRUE
(
!
img_l
.
empty
()
&&
!
img_r
.
empty
()
&&
!
img_template
.
empty
());
PRINT_PARAM
(
devInfo
);
cv
::
Mat
disp
;
...
...
modules/gpu/test/test_features2d.cpp
View file @
f4f38fcc
...
...
@@ -48,14 +48,21 @@
struct
SURF
:
testing
::
TestWithParam
<
cv
::
gpu
::
DeviceInfo
>
{
static
cv
::
Mat
image
;
static
cv
::
Mat
mask
;
st
atic
st
d
::
vector
<
cv
::
KeyPoint
>
keypoints_gold
;
st
atic
st
d
::
vector
<
float
>
descriptors_gold
;
cv
::
Mat
image
;
cv
::
Mat
mask
;
std
::
vector
<
cv
::
KeyPoint
>
keypoints_gold
;
std
::
vector
<
float
>
descriptors_gold
;
static
void
SetUpTestCase
()
cv
::
gpu
::
DeviceInfo
devInfo
;
virtual
void
SetUp
()
{
devInfo
=
GetParam
();
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
));
...
...
@@ -64,23 +71,6 @@ struct SURF : testing::TestWithParam<cv::gpu::DeviceInfo>
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
;
virtual
void
SetUp
()
{
devInfo
=
GetParam
();
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
}
bool
isSimilarKeypoints
(
const
cv
::
KeyPoint
&
p1
,
const
cv
::
KeyPoint
&
p2
)
{
const
float
maxPtDif
=
1.
f
;
...
...
@@ -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
)
{
PRINT_PARAM
(
devInfo
);
...
...
@@ -123,8 +108,6 @@ TEST_P(SURF, EmptyDataTest)
TEST_P
(
SURF
,
Accuracy
)
{
ASSERT_TRUE
(
!
image
.
empty
());
PRINT_PARAM
(
devInfo
);
// Compute keypoints.
...
...
@@ -165,7 +148,7 @@ TEST_P(SURF, Accuracy)
abs
(
p1
.
angle
-
p2
.
angle
)
<
maxAngleDif
&&
abs
(
p1
.
response
-
p2
.
response
)
<
maxResponseDif
&&
p1
.
octave
==
p2
.
octave
&&
p1
.
class_id
==
p2
.
class_id
)
p1
.
class_id
==
p2
.
class_id
)
{
++
validCount
;
}
...
...
modules/gpu/test/test_filters.cpp
View file @
f4f38fcc
...
...
@@ -43,39 +43,20 @@
#ifdef HAVE_CUDA
struct
FilterTest
namespace
{
static
cv
::
Mat
img_rgba
;
static
cv
::
Mat
img_gray
;
static
void
SetUpTestCase
()
double
checkNorm
(
const
cv
::
Mat
&
m1
,
const
cv
::
Mat
&
m2
,
const
cv
::
Size
&
ksize
)
{
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
::
Mat
m1ROI
=
m1
(
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
));
}
}
#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
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
::
Size
ksize
;
cv
::
Mat
img_rgba
;
cv
::
Mat
img_gray
;
cv
::
Mat
dst_gold_rgba
;
cv
::
Mat
dst_gold_gray
;
using
FilterTest
::
SetUpTestCase
;
using
FilterTest
::
TearDownTestCase
;
virtual
void
SetUp
()
{
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
::
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_gray
,
dst_gold_gray
,
ksize
);
}
...
...
@@ -113,8 +100,6 @@ struct Blur : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::Devic
TEST_P
(
Blur
,
Accuracy
)
{
ASSERT_TRUE
(
!
img_rgba
.
empty
()
&&
!
img_gray
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_PARAM
(
ksize
);
...
...
@@ -144,18 +129,18 @@ INSTANTIATE_TEST_CASE_P(Filter, Blur, testing::Combine(
/////////////////////////////////////////////////////////////////////////////////////////////////
// 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
;
int
ksize
;
int
dx
,
dy
;
cv
::
Mat
img_rgba
;
cv
::
Mat
img_gray
;
cv
::
Mat
dst_gold_rgba
;
cv
::
Mat
dst_gold_gray
;
using
FilterTest
::
SetUpTestCase
;
using
FilterTest
::
TearDownTestCase
;
virtual
void
SetUp
()
{
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
::
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_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
)
{
ASSERT_TRUE
(
!
img_rgba
.
empty
()
&&
!
img_gray
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_PARAM
(
ksize
);
PRINT_PARAM
(
dx
);
...
...
@@ -205,17 +194,17 @@ INSTANTIATE_TEST_CASE_P(Filter, Sobel, testing::Combine(
/////////////////////////////////////////////////////////////////////////////////////////////////
// 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
;
int
dx
,
dy
;
cv
::
Mat
img_rgba
;
cv
::
Mat
img_gray
;
cv
::
Mat
dst_gold_rgba
;
cv
::
Mat
dst_gold_gray
;
using
FilterTest
::
SetUpTestCase
;
using
FilterTest
::
TearDownTestCase
;
virtual
void
SetUp
()
{
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
::
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_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
)
{
ASSERT_TRUE
(
!
img_rgba
.
empty
()
&&
!
img_gray
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_PARAM
(
dx
);
PRINT_PARAM
(
dy
);
...
...
@@ -262,19 +255,19 @@ INSTANTIATE_TEST_CASE_P(Filter, Scharr, testing::Combine(
/////////////////////////////////////////////////////////////////////////////////////////////////
// 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
::
Size
ksize
;
cv
::
Mat
img_rgba
;
cv
::
Mat
img_gray
;
double
sigma1
,
sigma2
;
cv
::
Mat
dst_gold_rgba
;
cv
::
Mat
dst_gold_gray
;
using
FilterTest
::
SetUpTestCase
;
using
FilterTest
::
TearDownTestCase
;
virtual
void
SetUp
()
{
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
::
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
();
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
)
{
ASSERT_TRUE
(
!
img_rgba
.
empty
()
&&
!
img_gray
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_PARAM
(
ksize
);
PRINT_PARAM
(
sigma1
);
...
...
@@ -327,17 +324,17 @@ INSTANTIATE_TEST_CASE_P(Filter, GaussianBlur, testing::Combine(
/////////////////////////////////////////////////////////////////////////////////////////////////
// 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
;
int
ksize
;
cv
::
Mat
img_rgba
;
cv
::
Mat
img_gray
;
cv
::
Mat
dst_gold_rgba
;
cv
::
Mat
dst_gold_gray
;
using
FilterTest
::
SetUpTestCase
;
using
FilterTest
::
TearDownTestCase
;
virtual
void
SetUp
()
{
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
::
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_gray
,
dst_gold_gray
,
-
1
,
ksize
);
}
...
...
@@ -352,8 +355,6 @@ struct Laplacian : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::
TEST_P
(
Laplacian
,
Accuracy
)
{
ASSERT_TRUE
(
!
img_rgba
.
empty
()
&&
!
img_gray
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_PARAM
(
ksize
);
...
...
@@ -382,18 +383,18 @@ INSTANTIATE_TEST_CASE_P(Filter, Laplacian, testing::Combine(
/////////////////////////////////////////////////////////////////////////////////////////////////
// erode
struct
Erode
:
FilterTest
,
testing
::
TestWithParam
<
cv
::
gpu
::
DeviceInfo
>
struct
Erode
:
testing
::
TestWithParam
<
cv
::
gpu
::
DeviceInfo
>
{
cv
::
gpu
::
DeviceInfo
devInfo
;
cv
::
Mat
img_rgba
;
cv
::
Mat
img_gray
;
cv
::
Mat
kernel
;
cv
::
Mat
dst_gold_rgba
;
cv
::
Mat
dst_gold_gray
;
using
FilterTest
::
SetUpTestCase
;
using
FilterTest
::
TearDownTestCase
;
virtual
void
SetUp
()
{
devInfo
=
GetParam
();
...
...
@@ -402,6 +403,12 @@ struct Erode : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
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_gray
,
dst_gold_gray
,
kernel
);
}
...
...
@@ -409,8 +416,6 @@ struct Erode : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
TEST_P
(
Erode
,
Accuracy
)
{
ASSERT_TRUE
(
!
img_rgba
.
empty
()
&&
!
img_gray
.
empty
());
PRINT_PARAM
(
devInfo
);
cv
::
Mat
dst_rgba
;
...
...
@@ -436,18 +441,18 @@ INSTANTIATE_TEST_CASE_P(Filter, Erode, testing::ValuesIn(devices()));
/////////////////////////////////////////////////////////////////////////////////////////////////
// dilate
struct
Dilate
:
FilterTest
,
testing
::
TestWithParam
<
cv
::
gpu
::
DeviceInfo
>
struct
Dilate
:
testing
::
TestWithParam
<
cv
::
gpu
::
DeviceInfo
>
{
cv
::
gpu
::
DeviceInfo
devInfo
;
cv
::
Mat
img_rgba
;
cv
::
Mat
img_gray
;
cv
::
Mat
kernel
;
cv
::
Mat
dst_gold_rgba
;
cv
::
Mat
dst_gold_gray
;
using
FilterTest
::
SetUpTestCase
;
using
FilterTest
::
TearDownTestCase
;
virtual
void
SetUp
()
{
devInfo
=
GetParam
();
...
...
@@ -456,6 +461,12 @@ struct Dilate : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
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_gray
,
dst_gold_gray
,
kernel
);
}
...
...
@@ -463,8 +474,6 @@ struct Dilate : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
TEST_P
(
Dilate
,
Accuracy
)
{
ASSERT_TRUE
(
!
img_rgba
.
empty
()
&&
!
img_gray
.
empty
());
PRINT_PARAM
(
devInfo
);
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
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
;
int
morphOpsIdx
;
cv
::
Mat
img_rgba
;
cv
::
Mat
img_gray
;
cv
::
Mat
kernel
;
cv
::
Mat
dst_gold_rgba
;
cv
::
Mat
dst_gold_gray
;
using
FilterTest
::
SetUpTestCase
;
using
FilterTest
::
TearDownTestCase
;
virtual
void
SetUp
()
{
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
::
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
);
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
)
{
ASSERT_TRUE
(
!
img_rgba
.
empty
()
&&
!
img_gray
.
empty
());
const
char
*
morphOpStr
=
morphOps_str
[
morphOpsIdx
];
PRINT_PARAM
(
devInfo
);
...
...
modules/gpu/test/test_hog.cpp
View file @
f4f38fcc
...
...
@@ -50,7 +50,7 @@ struct CV_GpuHogDetectTestRunner : cv::gpu::HOGDescriptor
void
run
()
{
cv
::
Mat
img_rgb
=
readImage
(
"hog/road.png"
);
ASSERT_
TRUE
(
!
img_rgb
.
empty
());
ASSERT_
FALSE
(
img_rgb
.
empty
());
#ifdef DUMP
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)
cv
::
Mat
img_rgb
=
readImage
(
"hog/train_data.png"
);
ASSERT_
TRUE
(
!
img_rgb
.
empty
());
ASSERT_
FALSE
(
img_rgb
.
empty
());
// Convert to C4
cv
::
Mat
img
;
...
...
modules/gpu/test/test_imgproc.cpp
View file @
f4f38fcc
...
...
@@ -441,18 +441,6 @@ INSTANTIATE_TEST_CASE_P(ImgProc, Integral, testing::ValuesIn(devices()));
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
;
int
type
;
...
...
@@ -465,16 +453,15 @@ struct CvtColor : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, i
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
);
}
};
cv
::
Mat
CvtColor
::
imgBase
;
TEST_P
(
CvtColor
,
BGR2RGB
)
{
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -497,8 +484,6 @@ TEST_P(CvtColor, BGR2RGB)
TEST_P
(
CvtColor
,
BGR2RGBA
)
{
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -521,8 +506,6 @@ TEST_P(CvtColor, BGR2RGBA)
TEST_P
(
CvtColor
,
BGRA2RGB
)
{
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -546,8 +529,6 @@ TEST_P(CvtColor, BGRA2RGB)
TEST_P
(
CvtColor
,
BGR2YCrCb
)
{
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -570,8 +551,6 @@ TEST_P(CvtColor, BGR2YCrCb)
TEST_P
(
CvtColor
,
YCrCb2RGB
)
{
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -595,8 +574,6 @@ TEST_P(CvtColor, YCrCb2RGB)
TEST_P
(
CvtColor
,
BGR2YUV
)
{
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -619,8 +596,6 @@ TEST_P(CvtColor, BGR2YUV)
TEST_P
(
CvtColor
,
YUV2BGR
)
{
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -644,8 +619,6 @@ TEST_P(CvtColor, YUV2BGR)
TEST_P
(
CvtColor
,
BGR2XYZ
)
{
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -668,8 +641,6 @@ TEST_P(CvtColor, BGR2XYZ)
TEST_P
(
CvtColor
,
XYZ2BGR
)
{
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -696,8 +667,6 @@ TEST_P(CvtColor, BGR2HSV)
if
(
type
==
CV_16U
)
return
;
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -723,8 +692,6 @@ TEST_P(CvtColor, HSV2BGR)
if
(
type
==
CV_16U
)
return
;
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -751,8 +718,6 @@ TEST_P(CvtColor, BGR2HSV_FULL)
if
(
type
==
CV_16U
)
return
;
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -778,8 +743,6 @@ TEST_P(CvtColor, HSV2BGR_FULL)
if
(
type
==
CV_16U
)
return
;
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -806,8 +769,6 @@ TEST_P(CvtColor, BGR2HLS)
if
(
type
==
CV_16U
)
return
;
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -833,8 +794,6 @@ TEST_P(CvtColor, HLS2BGR)
if
(
type
==
CV_16U
)
return
;
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -861,8 +820,6 @@ TEST_P(CvtColor, BGR2HLS_FULL)
if
(
type
==
CV_16U
)
return
;
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -888,8 +845,6 @@ TEST_P(CvtColor, HLS2BGR_FULL)
if
(
type
==
CV_16U
)
return
;
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -913,8 +868,6 @@ TEST_P(CvtColor, HLS2BGR_FULL)
TEST_P
(
CvtColor
,
BGR2GRAY
)
{
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -937,8 +890,6 @@ TEST_P(CvtColor, BGR2GRAY)
TEST_P
(
CvtColor
,
GRAY2RGB
)
{
ASSERT_TRUE
(
!
img
.
empty
());
PRINT_PARAM
(
devInfo
);
PRINT_TYPE
(
type
);
...
...
@@ -969,21 +920,10 @@ INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor, testing::Combine(
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
::
Mat
hsv
;
int
hbins
;
float
hranges
[
2
];
...
...
@@ -995,6 +935,11 @@ struct HistEven : testing::TestWithParam<cv::gpu::DeviceInfo>
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
;
hranges
[
0
]
=
0
;
...
...
@@ -1014,8 +959,6 @@ struct HistEven : testing::TestWithParam<cv::gpu::DeviceInfo>
}
};
cv
::
Mat
HistEven
::
hsv
;
TEST_P
(
HistEven
,
Accuracy
)
{
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
>
>
{
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
;
int
type
;
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
::
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
);
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
)
{
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
>
>
{
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
;
int
type
;
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
::
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
);
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
)
{
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
>
{
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
::
Mat
rgba
;
int
spatialRad
;
int
colorRad
;
...
...
@@ -1499,13 +1409,16 @@ struct MeanShift : testing::TestWithParam<cv::gpu::DeviceInfo>
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
cv
::
Mat
img
=
readImage
(
"meanshift/cones.png"
);
ASSERT_FALSE
(
img
.
empty
());
cv
::
cvtColor
(
img
,
rgba
,
CV_BGR2BGRA
);
spatialRad
=
30
;
colorRad
=
30
;
}
};
cv
::
Mat
MeanShift
::
rgba
;
TEST_P
(
MeanShift
,
Filtering
)
{
cv
::
Mat
img_template
;
...
...
@@ -1515,7 +1428,7 @@ TEST_P(MeanShift, Filtering)
else
img_template
=
readImage
(
"meanshift/con_result_CC1X.png"
);
ASSERT_
TRUE
(
!
rgba
.
empty
()
&&
!
img_template
.
empty
());
ASSERT_
FALSE
(
img_template
.
empty
());
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
>
>
{
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
;
int
minsize
;
cv
::
Mat
rgba
;
cv
::
Mat
dst_gold
;
virtual
void
SetUp
()
...
...
@@ -1605,6 +1507,11 @@ struct MeanShiftSegmentation : testing::TestWithParam< std::tr1::tuple<cv::gpu::
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
;
path
<<
"meanshift/cones_segmented_sp10_sr10_minsize"
<<
minsize
;
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"
;
dst_gold
=
readImage
(
path
.
str
());
ASSERT_FALSE
(
dst_gold
.
empty
());
}
};
cv
::
Mat
MeanShiftSegmentation
::
rgba
;
TEST_P
(
MeanShiftSegmentation
,
Regression
)
{
ASSERT_TRUE
(
!
rgba
.
empty
()
&&
!
dst_gold
.
empty
());
PRINT_PARAM
(
devInfo
);
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
>
>
{
static
cv
::
Mat
image
;
static
cv
::
Mat
pattern
;
static
cv
::
Point
maxLocGold
;
static
void
SetUpTestCase
()
{
image
=
readImage
(
"matchtemplate/black.png"
);
pattern
=
readImage
(
"matchtemplate/cat.png"
);
cv
::
Mat
image
;
cv
::
Mat
pattern
;
maxLocGold
=
cv
::
Point
(
284
,
12
);
}
static
void
TearDownTestCase
()
{
image
.
release
();
pattern
.
release
();
}
cv
::
Point
maxLocGold
;
cv
::
gpu
::
DeviceInfo
devInfo
;
int
method
;
...
...
@@ -1796,17 +1686,19 @@ struct MatchTemplate : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceIn
method
=
std
::
tr1
::
get
<
1
>
(
GetParam
());
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
)
{
ASSERT_TRUE
(
!
image
.
empty
()
&&
!
pattern
.
empty
());
const
char
*
matchTemplateMethodStr
=
matchTemplateMethods
[
method
];
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
)
{
PRINT_PARAM
(
hint
);
...
...
@@ -2146,10 +2039,21 @@ struct PyrDown : testing::TestWithParam<cv::gpu::DeviceInfo>
{
cv
::
gpu
::
DeviceInfo
devInfo
;
cv
::
Mat
src
;
cv
::
Mat
dst_gold
;
virtual
void
SetUp
()
{
devInfo
=
GetParam
();
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
);
cv
::
Mat
src
;
readImage
(
"stereobm/aloe-L.png"
).
convertTo
(
src
,
CV_16S
);
cv
::
Mat
dst_gold
;
cv
::
pyrDown
(
src
,
dst_gold
);
cv
::
Mat
dst
;
ASSERT_NO_THROW
(
cv
::
gpu
::
GpuMat
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
);
ASSERT_EQ
(
dst_gold
.
rows
,
dst_mine
.
rows
);
ASSERT_EQ
(
dst_gold
.
type
(),
dst_mine
.
type
());
d_dst
.
download
(
dst
);
);
double
err
=
cvtest
::
crossCorr
(
dst_gold
,
dst_mine
)
/
(
cv
::
norm
(
dst_gold
,
cv
::
NORM_L2
)
*
cv
::
norm
(
dst_mine
,
cv
::
NORM_L2
));
ASSERT_EQ
(
dst_gold
.
cols
,
dst
.
cols
);
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
);
}
...
...
@@ -2185,10 +2089,21 @@ struct PyrUp: testing::TestWithParam<cv::gpu::DeviceInfo>
{
cv
::
gpu
::
DeviceInfo
devInfo
;
cv
::
Mat
src
;
cv
::
Mat
dst_gold
;
virtual
void
SetUp
()
{
devInfo
=
GetParam
();
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
);
cv
::
Mat
src
;
readImage
(
"stereobm/aloe-L.png"
).
convertTo
(
src
,
CV_16S
);
cv
::
Mat
dst_gold
;
cv
::
pyrUp
(
src
,
dst_gold
);
cv
::
Mat
dst
;
ASSERT_NO_THROW
(
cv
::
gpu
::
GpuMat
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
);
ASSERT_EQ
(
dst_gold
.
rows
,
dst_mine
.
rows
);
ASSERT_EQ
(
dst_gold
.
type
(),
dst_mine
.
type
());
d_dst
.
download
(
dst
);
);
ASSERT_EQ
(
dst_gold
.
cols
,
dst
.
cols
);
ASSERT_EQ
(
dst_gold
.
rows
,
dst
.
rows
);
ASSERT_EQ
(
dst_gold
.
type
(),
dst
.
type
());
double
err
=
cvtest
::
crossCorr
(
dst_gold
,
dst
_mine
)
/
(
cv
::
norm
(
dst_gold
,
cv
::
NORM_L2
)
*
cv
::
norm
(
dst
_mine
,
cv
::
NORM_L2
));
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
);
}
...
...
@@ -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
>
>
{
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
;
int
apperture_size
;
bool
L2gradient
;
cv
::
Mat
img
;
double
low_thresh
;
double
high_thresh
;
...
...
@@ -2251,6 +2156,9 @@ struct Canny : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int,
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
img
=
readImage
(
"stereobm/aloe-L.png"
,
CV_LOAD_IMAGE_GRAYSCALE
);
ASSERT_FALSE
(
img
.
empty
());
low_thresh
=
50.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
)
{
PRINT_PARAM
(
devInfo
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment