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
da279024
Commit
da279024
authored
Jan 07, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added NORM_L2SQR type to cv::norm
parent
2e5e2782
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
7 deletions
+26
-7
perf_arithm.cpp
modules/core/perf/opencl/perf_arithm.cpp
+1
-1
stat.cpp
modules/core/src/stat.cpp
+5
-5
test_arithm.cpp
modules/core/test/ocl/test_arithm.cpp
+20
-1
No files found.
modules/core/perf/opencl/perf_arithm.cpp
View file @
da279024
...
...
@@ -909,7 +909,7 @@ OCL_PERF_TEST_P(PSNRFixture, PSNR,
OCL_TEST_CYCLE
()
psnr
=
cv
::
PSNR
(
src1
,
src2
);
SANITY_CHECK
(
psnr
,
1e-
6
,
ERROR_RELATIVE
);
SANITY_CHECK
(
psnr
,
1e-
4
,
ERROR_RELATIVE
);
}
}
}
// namespace cvtest::ocl
...
...
modules/core/src/stat.cpp
View file @
da279024
...
...
@@ -1902,7 +1902,7 @@ static bool ocl_norm( InputArray _src, int normType, InputArray _mask, double &
bool
doubleSupport
=
ocl
::
Device
::
getDefault
().
doubleFPConfig
()
>
0
,
haveMask
=
_mask
.
kind
()
!=
_InputArray
::
NONE
;
if
(
!
(
normType
==
NORM_INF
||
normType
==
NORM_L1
||
normType
==
NORM_L2
)
||
if
(
!
(
normType
==
NORM_INF
||
normType
==
NORM_L1
||
normType
==
NORM_L2
||
normType
==
NORM_L2SQR
)
||
(
!
doubleSupport
&&
depth
==
CV_64F
)
||
(
normType
==
NORM_INF
&&
haveMask
&&
cn
!=
1
))
return
false
;
...
...
@@ -1937,12 +1937,12 @@ static bool ocl_norm( InputArray _src, int normType, InputArray _mask, double &
cv
::
minMaxIdx
(
haveMask
?
abssrc
:
abssrc
.
reshape
(
1
),
NULL
,
&
result
,
NULL
,
NULL
,
_mask
);
}
else
if
(
normType
==
NORM_L1
||
normType
==
NORM_L2
)
else
if
(
normType
==
NORM_L1
||
normType
==
NORM_L2
||
normType
==
NORM_L2SQR
)
{
Scalar
sc
;
bool
unstype
=
depth
==
CV_8U
||
depth
==
CV_16U
;
if
(
!
ocl_sum
(
haveMask
?
src
:
src
.
reshape
(
1
),
sc
,
normType
==
NORM_L2
?
if
(
!
ocl_sum
(
haveMask
?
src
:
src
.
reshape
(
1
),
sc
,
normType
==
NORM_L2
||
normType
==
NORM_L2SQR
?
OCL_OP_SUM_SQR
:
(
unstype
?
OCL_OP_SUM
:
OCL_OP_SUM_ABS
),
_mask
)
)
return
false
;
...
...
@@ -1953,7 +1953,7 @@ static bool ocl_norm( InputArray _src, int normType, InputArray _mask, double &
for
(
int
i
=
0
;
i
<
cn
;
++
i
)
s
+=
sc
[
i
];
result
=
normType
==
NORM_L1
?
s
:
std
::
sqrt
(
s
);
result
=
normType
==
NORM_L1
||
normType
==
NORM_L2SQR
?
s
:
std
::
sqrt
(
s
);
}
return
true
;
...
...
@@ -2261,7 +2261,7 @@ static bool ocl_norm( InputArray _src1, InputArray _src2, int normType, double &
bool
relative
=
(
normType
&
NORM_RELATIVE
)
!=
0
;
normType
&=
~
NORM_RELATIVE
;
if
(
!
(
normType
==
NORM_INF
||
normType
==
NORM_L1
||
normType
==
NORM_L2
)
||
if
(
!
(
normType
==
NORM_INF
||
normType
==
NORM_L1
||
normType
==
NORM_L2
||
normType
==
NORM_L2SQR
)
||
(
!
doubleSupport
&&
depth
==
CV_64F
))
return
false
;
...
...
modules/core/test/ocl/test_arithm.cpp
View file @
da279024
...
...
@@ -1011,7 +1011,6 @@ OCL_TEST_P(Phase, angleInDegree)
}
}
OCL_TEST_P
(
Phase
,
angleInRadians
)
{
for
(
int
j
=
0
;
j
<
test_loop_times
;
j
++
)
...
...
@@ -1548,6 +1547,25 @@ OCL_TEST_P(PatchNaNs, Mat)
}
}
//////////////////////////////// Psnr ////////////////////////////////////////////////
typedef
ArithmTestBase
Psnr
;
OCL_TEST_P
(
Psnr
,
Mat
)
{
for
(
int
j
=
0
;
j
<
test_loop_times
;
j
++
)
{
generateTestData
();
double
cpuRes
=
0
,
gpuRes
=
0
;
OCL_OFF
(
cpuRes
=
cv
::
PSNR
(
src1_roi
,
src2_roi
));
OCL_ON
(
gpuRes
=
cv
::
PSNR
(
usrc1_roi
,
usrc2_roi
));
EXPECT_PRED3
(
relativeError
,
cpuRes
,
gpuRes
,
1e-6
);
}
}
//////////////////////////////////////// Instantiation /////////////////////////////////////////
OCL_INSTANTIATE_TEST_CASE_P
(
Arithm
,
Lut
,
Combine
(
::
testing
::
Values
(
CV_8U
,
CV_8S
),
OCL_ALL_DEPTHS
,
OCL_ALL_CHANNELS
,
Bool
(),
Bool
()));
...
...
@@ -1587,6 +1605,7 @@ OCL_INSTANTIATE_TEST_CASE_P(Arithm, InRange, Combine(OCL_ALL_DEPTHS, OCL_ALL_CHA
OCL_INSTANTIATE_TEST_CASE_P
(
Arithm
,
ConvertScaleAbs
,
Combine
(
OCL_ALL_DEPTHS
,
OCL_ALL_CHANNELS
,
Bool
()));
OCL_INSTANTIATE_TEST_CASE_P
(
Arithm
,
ScaleAdd
,
Combine
(
OCL_ALL_DEPTHS
,
OCL_ALL_CHANNELS
,
Bool
()));
OCL_INSTANTIATE_TEST_CASE_P
(
Arithm
,
PatchNaNs
,
Combine
(
OCL_ALL_CHANNELS
,
Bool
()));
OCL_INSTANTIATE_TEST_CASE_P
(
Arithm
,
Psnr
,
Combine
(
::
testing
::
Values
((
MatDepth
)
CV_8U
),
OCL_ALL_CHANNELS
,
Bool
()));
}
}
// namespace cvtest::ocl
...
...
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