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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
261 additions
and
355 deletions
+261
-355
test_calib3d.cpp
modules/gpu/test/test_calib3d.cpp
+48
-44
test_features2d.cpp
modules/gpu/test/test_features2d.cpp
+18
-35
test_filters.cpp
modules/gpu/test/test_filters.cpp
+89
-76
test_hog.cpp
modules/gpu/test/test_hog.cpp
+2
-2
test_imgproc.cpp
modules/gpu/test/test_imgproc.cpp
+104
-198
No files found.
modules/gpu/test/test_calib3d.cpp
View file @
f4f38fcc
...
@@ -43,50 +43,35 @@
...
@@ -43,50 +43,35 @@
#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
()
{
img_l
.
release
();
img_r
.
release
();
img_template
.
release
();
}
cv
::
gpu
::
DeviceInfo
devInfo
;
struct
StereoBlockMatching
:
testing
::
TestWithParam
<
cv
::
gpu
::
DeviceInfo
>
{
cv
::
Mat
img_l
;
cv
::
Mat
img_r
;
cv
::
Mat
img_template
;
cv
::
gpu
::
DeviceInfo
devInfo
;
virtual
void
SetUp
()
virtual
void
SetUp
()
{
{
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(
...
@@ -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
...
@@ -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
;
...
...
modules/gpu/test/test_features2d.cpp
View file @
f4f38fcc
...
@@ -48,29 +48,10 @@
...
@@ -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>
...
@@ -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>
...
@@ -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)
...
@@ -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.
...
@@ -161,11 +144,11 @@ TEST_P(SURF, Accuracy)
...
@@ -161,11 +144,11 @@ TEST_P(SURF, Accuracy)
float
dist
=
(
float
)
cv
::
norm
(
p1
.
pt
-
p2
.
pt
);
float
dist
=
(
float
)
cv
::
norm
(
p1
.
pt
-
p2
.
pt
);
if
(
dist
<
maxPtDif
&&
if
(
dist
<
maxPtDif
&&
fabs
(
p1
.
size
-
p2
.
size
)
<
maxSizeDif
&&
fabs
(
p1
.
size
-
p2
.
size
)
<
maxSizeDif
&&
abs
(
p1
.
angle
-
p2
.
angle
)
<
maxAngleDif
&&
abs
(
p1
.
angle
-
p2
.
angle
)
<
maxAngleDif
&&
abs
(
p1
.
response
-
p2
.
response
)
<
maxResponseDif
&&
abs
(
p1
.
response
-
p2
.
response
)
<
maxResponseDif
&&
p1
.
octave
==
p2
.
octave
&&
p1
.
octave
==
p2
.
octave
&&
p1
.
class_id
==
p2
.
class_id
)
p1
.
class_id
==
p2
.
class_id
)
{
{
++
validCount
;
++
validCount
;
}
}
...
...
modules/gpu/test/test_filters.cpp
View file @
f4f38fcc
...
@@ -43,39 +43,20 @@
...
@@ -43,39 +43,20 @@
#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
::
Rect
roi
(
ksize
.
width
,
ksize
.
height
,
m1
.
cols
-
2
*
ksize
.
width
,
m1
.
rows
-
2
*
ksize
.
height
);
cv
::
cvtColor
(
img
,
img_rgba
,
CV_BGR2BGRA
);
cv
::
Mat
m1ROI
=
m1
(
roi
);
cv
::
cvtColor
(
img
,
img_gray
,
CV_BGR2GRAY
);
cv
::
Mat
m2ROI
=
m2
(
roi
);
return
::
checkNorm
(
m1ROI
,
m2ROI
);
}
}
static
void
TearDownTestCase
()
double
checkNorm
(
const
cv
::
Mat
&
m1
,
const
cv
::
Mat
&
m2
,
int
ksize
)
{
{
img_rgba
.
release
();
return
checkNorm
(
m1
,
m2
,
cv
::
Size
(
ksize
,
ksize
));
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
);
}
static
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) \
#define EXPECT_MAT_NEAR_KSIZE(mat1, mat2, ksize, eps) \
...
@@ -88,16 +69,16 @@ static double checkNorm(const cv::Mat& m1, const cv::Mat& m2, int ksize)
...
@@ -88,16 +69,16 @@ 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
()
{
{
...
@@ -105,6 +86,12 @@ struct Blur : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::Devic
...
@@ -105,6 +86,12 @@ struct Blur : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::Devic
ksize
=
cv
::
Size
(
std
::
tr1
::
get
<
1
>
(
GetParam
()),
std
::
tr1
::
get
<
2
>
(
GetParam
()));
ksize
=
cv
::
Size
(
std
::
tr1
::
get
<
1
>
(
GetParam
()),
std
::
tr1
::
get
<
2
>
(
GetParam
()));
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
...
@@ -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,17 +129,17 @@ INSTANTIATE_TEST_CASE_P(Filter, Blur, testing::Combine(
...
@@ -144,17 +129,17 @@ 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
()
{
{
...
@@ -165,6 +150,12 @@ struct Sobel : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::Devi
...
@@ -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
...
@@ -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,16 +194,16 @@ INSTANTIATE_TEST_CASE_P(Filter, Sobel, testing::Combine(
...
@@ -205,16 +194,16 @@ 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
()
{
{
...
@@ -223,6 +212,12 @@ struct Scharr : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::Dev
...
@@ -223,6 +212,12 @@ struct Scharr : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::Dev
dx
=
d
.
first
;
dy
=
d
.
second
;
dx
=
d
.
first
;
dy
=
d
.
second
;
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
...
@@ -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,18 +255,18 @@ INSTANTIATE_TEST_CASE_P(Filter, Scharr, testing::Combine(
...
@@ -262,18 +255,18 @@ 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
()
{
{
...
@@ -282,6 +275,12 @@ struct GaussianBlur : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gp
...
@@ -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
...
@@ -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,16 +324,16 @@ INSTANTIATE_TEST_CASE_P(Filter, GaussianBlur, testing::Combine(
...
@@ -327,16 +324,16 @@ 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
()
{
{
...
@@ -344,6 +341,12 @@ struct Laplacian : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::
...
@@ -344,6 +341,12 @@ struct Laplacian : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::
ksize
=
std
::
tr1
::
get
<
1
>
(
GetParam
());
ksize
=
std
::
tr1
::
get
<
1
>
(
GetParam
());
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::
...
@@ -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,17 +383,17 @@ INSTANTIATE_TEST_CASE_P(Filter, Laplacian, testing::Combine(
...
@@ -382,17 +383,17 @@ 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
()
{
{
...
@@ -401,6 +402,12 @@ struct Erode : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
...
@@ -401,6 +402,12 @@ struct Erode : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
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>
...
@@ -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,17 +441,17 @@ INSTANTIATE_TEST_CASE_P(Filter, Erode, testing::ValuesIn(devices()));
...
@@ -436,17 +441,17 @@ 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
()
{
{
...
@@ -455,6 +460,12 @@ struct Dilate : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
...
@@ -455,6 +460,12 @@ struct Dilate : FilterTest, testing::TestWithParam<cv::gpu::DeviceInfo>
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
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>
...
@@ -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,18 +502,18 @@ INSTANTIATE_TEST_CASE_P(Filter, Dilate, testing::ValuesIn(devices()));
...
@@ -493,18 +502,18 @@ 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
()
{
{
...
@@ -512,9 +521,15 @@ struct MorphEx : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::De
...
@@ -512,9 +521,15 @@ struct MorphEx : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::De
morphOpsIdx
=
std
::
tr1
::
get
<
1
>
(
GetParam
());
morphOpsIdx
=
std
::
tr1
::
get
<
1
>
(
GetParam
());
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
);
cv
::
morphologyEx
(
img_gray
,
dst_gold_gray
,
morphOps
[
morphOpsIdx
],
kernel
);
cv
::
morphologyEx
(
img_gray
,
dst_gold_gray
,
morphOps
[
morphOpsIdx
],
kernel
);
}
}
...
@@ -522,8 +537,6 @@ struct MorphEx : FilterTest, testing::TestWithParam< std::tr1::tuple<cv::gpu::De
...
@@ -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
);
...
...
modules/gpu/test/test_hog.cpp
View file @
f4f38fcc
...
@@ -50,7 +50,7 @@ struct CV_GpuHogDetectTestRunner : cv::gpu::HOGDescriptor
...
@@ -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
...
@@ -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
;
...
...
modules/gpu/test/test_imgproc.cpp
View file @
f4f38fcc
...
@@ -441,21 +441,9 @@ INSTANTIATE_TEST_CASE_P(ImgProc, Integral, testing::ValuesIn(devices()));
...
@@ -441,21 +441,9 @@ 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
;
cv
::
Mat
img
;
cv
::
Mat
img
;
virtual
void
SetUp
()
virtual
void
SetUp
()
...
@@ -463,18 +451,17 @@ struct CvtColor : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, i
...
@@ -463,18 +451,17 @@ struct CvtColor : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, i
devInfo
=
std
::
tr1
::
get
<
0
>
(
GetParam
());
devInfo
=
std
::
tr1
::
get
<
0
>
(
GetParam
());
type
=
std
::
tr1
::
get
<
1
>
(
GetParam
());
type
=
std
::
tr1
::
get
<
1
>
(
GetParam
());
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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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)
...
@@ -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(
...
@@ -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
];
...
@@ -994,6 +934,11 @@ struct HistEven : testing::TestWithParam<cv::gpu::DeviceInfo>
...
@@ -994,6 +934,11 @@ struct HistEven : testing::TestWithParam<cv::gpu::DeviceInfo>
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
());
cv
::
cvtColor
(
img
,
hsv
,
CV_BGR2HSV
);
hbins
=
30
;
hbins
=
30
;
...
@@ -1014,8 +959,6 @@ struct HistEven : testing::TestWithParam<cv::gpu::DeviceInfo>
...
@@ -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", "
...
@@ -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
...
@@ -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
...
@@ -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(
...
@@ -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
;
...
@@ -1250,9 +1170,12 @@ struct CornerMinEigen : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceI
...
@@ -1250,9 +1170,12 @@ struct CornerMinEigen : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceI
type
=
std
::
tr1
::
get
<
1
>
(
GetParam
());
type
=
std
::
tr1
::
get
<
1
>
(
GetParam
());
borderTypeIdx
=
std
::
tr1
::
get
<
2
>
(
GetParam
());
borderTypeIdx
=
std
::
tr1
::
get
<
2
>
(
GetParam
());
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
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
);
...
@@ -1263,8 +1186,6 @@ struct CornerMinEigen : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceI
...
@@ -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,20 +1396,9 @@ INSTANTIATE_TEST_CASE_P(ImgProc, ReprojectImageTo3D, testing::ValuesIn(devices()
...
@@ -1475,20 +1396,9 @@ 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
;
...
@@ -1498,14 +1408,17 @@ struct MeanShift : testing::TestWithParam<cv::gpu::DeviceInfo>
...
@@ -1498,14 +1408,17 @@ struct MeanShift : testing::TestWithParam<cv::gpu::DeviceInfo>
devInfo
=
GetParam
();
devInfo
=
GetParam
();
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)
...
@@ -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,21 +1493,10 @@ INSTANTIATE_TEST_CASE_P(ImgProc, MeanShift, testing::ValuesIn(devices()));
...
@@ -1580,21 +1493,10 @@ 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
;
...
@@ -1604,6 +1506,11 @@ struct MeanShiftSegmentation : testing::TestWithParam< std::tr1::tuple<cv::gpu::
...
@@ -1604,6 +1506,11 @@ struct MeanShiftSegmentation : testing::TestWithParam< std::tr1::tuple<cv::gpu::
minsize
=
std
::
tr1
::
get
<
1
>
(
GetParam
());
minsize
=
std
::
tr1
::
get
<
1
>
(
GetParam
());
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
;
...
@@ -1613,15 +1520,12 @@ struct MeanShiftSegmentation : testing::TestWithParam< std::tr1::tuple<cv::gpu::
...
@@ -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(
...
@@ -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
;
static
void
SetUpTestCase
()
{
image
=
readImage
(
"matchtemplate/black.png"
);
pattern
=
readImage
(
"matchtemplate/cat.png"
);
maxLocGold
=
cv
::
Point
(
284
,
12
);
cv
::
Point
maxLocGold
;
}
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
...
@@ -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>
...
@@ -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
);
...
@@ -2143,36 +2036,47 @@ INSTANTIATE_TEST_CASE_P(ImgProc, Blend, testing::Combine(
...
@@ -2143,36 +2036,47 @@ INSTANTIATE_TEST_CASE_P(ImgProc, Blend, testing::Combine(
// pyrDown
// pyrDown
struct
PyrDown
:
testing
::
TestWithParam
<
cv
::
gpu
::
DeviceInfo
>
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
);
}
}
};
};
TEST_P
(
PyrDown
,
Accuracy
)
TEST_P
(
PyrDown
,
Accuracy
)
{
{
PRINT_PARAM
(
devInfo
);
PRINT_PARAM
(
devInfo
);
cv
::
Mat
dst
;
cv
::
Mat
src
;
ASSERT_NO_THROW
(
readImage
(
"stereobm/aloe-L.png"
).
convertTo
(
src
,
CV_16S
);
cv
::
gpu
::
GpuMat
d_dst
;
cv
::
Mat
dst_gold
;
cv
::
gpu
::
pyrDown
(
cv
::
gpu
::
GpuMat
(
src
),
d_dst
);
cv
::
pyrDown
(
src
,
dst_gold
);
d_dst
.
download
(
dst
);
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
.
cols
,
dst
.
cols
);
ASSERT_EQ
(
dst_gold
.
rows
,
dst
_mine
.
rows
);
ASSERT_EQ
(
dst_gold
.
rows
,
dst
.
rows
);
ASSERT_EQ
(
dst_gold
.
type
(),
dst
_mine
.
type
());
ASSERT_EQ
(
dst_gold
.
type
(),
dst
.
type
());
double
err
=
cvtest
::
crossCorr
(
dst_gold
,
dst
_mine
)
/
double
err
=
cvtest
::
crossCorr
(
dst_gold
,
dst
)
/
(
cv
::
norm
(
dst_gold
,
cv
::
NORM_L2
)
*
cv
::
norm
(
dst
_mine
,
cv
::
NORM_L2
));
(
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
);
}
}
...
@@ -2182,36 +2086,47 @@ INSTANTIATE_TEST_CASE_P(ImgProc, PyrDown, testing::ValuesIn(devices()));
...
@@ -2182,36 +2086,47 @@ INSTANTIATE_TEST_CASE_P(ImgProc, PyrDown, testing::ValuesIn(devices()));
// pyrUp
// pyrUp
struct
PyrUp
:
testing
::
TestWithParam
<
cv
::
gpu
::
DeviceInfo
>
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
);
}
}
};
};
TEST_P
(
PyrUp
,
Accuracy
)
TEST_P
(
PyrUp
,
Accuracy
)
{
{
PRINT_PARAM
(
devInfo
);
PRINT_PARAM
(
devInfo
);
cv
::
Mat
dst
;
cv
::
Mat
src
;
ASSERT_NO_THROW
(
readImage
(
"stereobm/aloe-L.png"
).
convertTo
(
src
,
CV_16S
);
cv
::
gpu
::
GpuMat
d_dst
;
cv
::
Mat
dst_gold
;
cv
::
gpu
::
pyrUp
(
cv
::
gpu
::
GpuMat
(
src
),
d_dst
);
cv
::
pyrUp
(
src
,
dst_gold
);
d_dst
.
download
(
dst
);
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
.
cols
,
dst
.
cols
);
ASSERT_EQ
(
dst_gold
.
rows
,
dst
_mine
.
rows
);
ASSERT_EQ
(
dst_gold
.
rows
,
dst
.
rows
);
ASSERT_EQ
(
dst_gold
.
type
(),
dst
_mine
.
type
());
ASSERT_EQ
(
dst_gold
.
type
(),
dst
.
type
());
double
err
=
cvtest
::
crossCorr
(
dst_gold
,
dst
_mine
)
/
double
err
=
cvtest
::
crossCorr
(
dst_gold
,
dst
)
/
(
cv
::
norm
(
dst_gold
,
cv
::
NORM_L2
)
*
cv
::
norm
(
dst
_mine
,
cv
::
NORM_L2
));
(
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,21 +2137,11 @@ INSTANTIATE_TEST_CASE_P(ImgProc, PyrUp, testing::ValuesIn(devices()));
...
@@ -2222,21 +2137,11 @@ 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
;
...
@@ -2250,6 +2155,9 @@ struct Canny : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int,
...
@@ -2250,6 +2155,9 @@ struct Canny : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int,
L2gradient
=
std
::
tr1
::
get
<
2
>
(
GetParam
());
L2gradient
=
std
::
tr1
::
get
<
2
>
(
GetParam
());
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,
...
@@ -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
);
...
...
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