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
99326123
Commit
99326123
authored
Sep 18, 2018
by
Hamdi Sahloul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cuda::polarToCart: test double precision and tune tolerance
parent
6203c95d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
13 deletions
+20
-13
perf_element_operations.cpp
modules/cudaarithm/perf/perf_element_operations.cpp
+7
-4
test_element_operations.cpp
modules/cudaarithm/test/test_element_operations.cpp
+13
-9
No files found.
modules/cudaarithm/perf/perf_element_operations.cpp
View file @
99326123
...
...
@@ -1346,6 +1346,7 @@ PERF_TEST_P(Sz, MagnitudeSqr,
// Phase
DEF_PARAM_TEST
(
Sz_AngleInDegrees
,
cv
::
Size
,
bool
);
DEF_PARAM_TEST
(
Sz_Type_AngleInDegrees
,
cv
::
Size
,
MatType
,
bool
);
PERF_TEST_P
(
Sz_AngleInDegrees
,
Phase
,
Combine
(
CUDA_TYPICAL_MAT_SIZES
,
...
...
@@ -1423,17 +1424,19 @@ PERF_TEST_P(Sz_AngleInDegrees, CartToPolar,
//////////////////////////////////////////////////////////////////////
// PolarToCart
PERF_TEST_P
(
Sz_AngleInDegrees
,
PolarToCart
,
PERF_TEST_P
(
Sz_
Type_
AngleInDegrees
,
PolarToCart
,
Combine
(
CUDA_TYPICAL_MAT_SIZES
,
testing
::
Values
(
CV_32FC1
,
CV_64FC1
),
Bool
()))
{
const
cv
::
Size
size
=
GET_PARAM
(
0
);
const
bool
angleInDegrees
=
GET_PARAM
(
1
);
const
int
type
=
GET_PARAM
(
1
);
const
bool
angleInDegrees
=
GET_PARAM
(
2
);
cv
::
Mat
magnitude
(
size
,
CV_32FC1
);
cv
::
Mat
magnitude
(
size
,
type
);
declare
.
in
(
magnitude
,
WARMUP_RNG
);
cv
::
Mat
angle
(
size
,
CV_32FC1
);
cv
::
Mat
angle
(
size
,
type
);
declare
.
in
(
angle
,
WARMUP_RNG
);
if
(
PERF_RUN_CUDA
())
...
...
modules/cudaarithm/test/test_element_operations.cpp
View file @
99326123
...
...
@@ -2754,10 +2754,11 @@ INSTANTIATE_TEST_CASE_P(CUDA_Arithm, CartToPolar, testing::Combine(
////////////////////////////////////////////////////////////////////////////////
// polarToCart
PARAM_TEST_CASE
(
PolarToCart
,
cv
::
cuda
::
DeviceInfo
,
cv
::
Size
,
AngleInDegrees
,
UseRoi
)
PARAM_TEST_CASE
(
PolarToCart
,
cv
::
cuda
::
DeviceInfo
,
cv
::
Size
,
MatType
,
AngleInDegrees
,
UseRoi
)
{
cv
::
cuda
::
DeviceInfo
devInfo
;
cv
::
Size
size
;
int
type
;
bool
angleInDegrees
;
bool
useRoi
;
...
...
@@ -2765,8 +2766,9 @@ PARAM_TEST_CASE(PolarToCart, cv::cuda::DeviceInfo, cv::Size, AngleInDegrees, Use
{
devInfo
=
GET_PARAM
(
0
);
size
=
GET_PARAM
(
1
);
angleInDegrees
=
GET_PARAM
(
2
);
useRoi
=
GET_PARAM
(
3
);
type
=
GET_PARAM
(
2
);
angleInDegrees
=
GET_PARAM
(
3
);
useRoi
=
GET_PARAM
(
4
);
cv
::
cuda
::
setDevice
(
devInfo
.
deviceID
());
}
...
...
@@ -2774,24 +2776,26 @@ PARAM_TEST_CASE(PolarToCart, cv::cuda::DeviceInfo, cv::Size, AngleInDegrees, Use
CUDA_TEST_P
(
PolarToCart
,
Accuracy
)
{
cv
::
Mat
magnitude
=
randomMat
(
size
,
CV_32FC1
);
cv
::
Mat
angle
=
randomMat
(
size
,
CV_32FC1
);
cv
::
Mat
magnitude
=
randomMat
(
size
,
type
);
cv
::
Mat
angle
=
randomMat
(
size
,
type
);
const
double
tol
=
(
type
==
CV_32FC1
?
1.6e-4
:
1e-4
)
*
(
angleInDegrees
?
1.0
:
19.0
);
cv
::
cuda
::
GpuMat
x
=
createMat
(
size
,
CV_32FC1
,
useRoi
);
cv
::
cuda
::
GpuMat
y
=
createMat
(
size
,
CV_32FC1
,
useRoi
);
cv
::
cuda
::
GpuMat
x
=
createMat
(
size
,
type
,
useRoi
);
cv
::
cuda
::
GpuMat
y
=
createMat
(
size
,
type
,
useRoi
);
cv
::
cuda
::
polarToCart
(
loadMat
(
magnitude
,
useRoi
),
loadMat
(
angle
,
useRoi
),
x
,
y
,
angleInDegrees
);
cv
::
Mat
x_gold
;
cv
::
Mat
y_gold
;
cv
::
polarToCart
(
magnitude
,
angle
,
x_gold
,
y_gold
,
angleInDegrees
);
EXPECT_MAT_NEAR
(
x_gold
,
x
,
1e-4
);
EXPECT_MAT_NEAR
(
y_gold
,
y
,
1e-4
);
EXPECT_MAT_NEAR
(
x_gold
,
x
,
tol
);
EXPECT_MAT_NEAR
(
y_gold
,
y
,
tol
);
}
INSTANTIATE_TEST_CASE_P
(
CUDA_Arithm
,
PolarToCart
,
testing
::
Combine
(
ALL_DEVICES
,
DIFFERENT_SIZES
,
testing
::
Values
(
CV_32FC1
,
CV_64FC1
),
testing
::
Values
(
AngleInDegrees
(
false
),
AngleInDegrees
(
true
)),
WHOLE_SUBMAT
));
...
...
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