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
4934f7c5
Commit
4934f7c5
authored
Apr 28, 2018
by
yuki takehara
Committed by
Alexander Alekhin
Apr 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge pull request #11285 from take1014:core_6125
* Resolves 6125 * Fix test code * Delete unnecessary code
parent
e7adce85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
5 deletions
+31
-5
convert_scale.cpp
modules/core/src/convert_scale.cpp
+12
-5
test_arithm.cpp
modules/core/test/test_arithm.cpp
+19
-0
No files found.
modules/core/src/convert_scale.cpp
View file @
4934f7c5
...
...
@@ -1885,13 +1885,24 @@ void cv::normalize( InputArray _src, InputOutputArray _dst, double a, double b,
CV_INSTRUMENT_REGION
()
double
scale
=
1
,
shift
=
0
;
int
type
=
_src
.
type
(),
depth
=
CV_MAT_DEPTH
(
type
);
if
(
rtype
<
0
)
rtype
=
_dst
.
fixedType
()
?
_dst
.
depth
()
:
depth
;
if
(
norm_type
==
CV_MINMAX
)
{
double
smin
=
0
,
smax
=
0
;
double
dmin
=
MIN
(
a
,
b
),
dmax
=
MAX
(
a
,
b
);
minMaxIdx
(
_src
,
&
smin
,
&
smax
,
0
,
0
,
_mask
);
scale
=
(
dmax
-
dmin
)
*
(
smax
-
smin
>
DBL_EPSILON
?
1.
/
(
smax
-
smin
)
:
0
);
shift
=
dmin
-
smin
*
scale
;
if
(
rtype
==
CV_32F
)
{
scale
=
(
float
)
scale
;
shift
=
(
float
)
dmin
-
(
float
)(
smin
*
scale
);
}
else
shift
=
dmin
-
smin
*
scale
;
}
else
if
(
norm_type
==
CV_L2
||
norm_type
==
CV_L1
||
norm_type
==
CV_C
)
{
...
...
@@ -1902,10 +1913,6 @@ void cv::normalize( InputArray _src, InputOutputArray _dst, double a, double b,
else
CV_Error
(
CV_StsBadArg
,
"Unknown/unsupported norm type"
);
int
type
=
_src
.
type
(),
depth
=
CV_MAT_DEPTH
(
type
);
if
(
rtype
<
0
)
rtype
=
_dst
.
fixedType
()
?
_dst
.
depth
()
:
depth
;
CV_OCL_RUN
(
_dst
.
isUMat
(),
ocl_normalize
(
_src
,
_dst
,
_mask
,
rtype
,
scale
,
shift
))
...
...
modules/core/test/test_arithm.cpp
View file @
4934f7c5
...
...
@@ -1918,6 +1918,25 @@ TEST(Normalize, regression_5876_inplace_change_type)
EXPECT_EQ
(
0
,
cvtest
::
norm
(
m
,
result
,
NORM_INF
));
}
TEST
(
Normalize
,
regression_6125
)
{
float
initial_values
[]
=
{
1888
,
1692
,
369
,
263
,
199
,
280
,
326
,
129
,
143
,
126
,
233
,
221
,
130
,
126
,
150
,
249
,
575
,
574
,
63
,
12
};
Mat
src
(
Size
(
20
,
1
),
CV_32F
,
initial_values
);
float
min
=
0.
,
max
=
400.
;
normalize
(
src
,
src
,
0
,
400
,
NORM_MINMAX
,
CV_32F
);
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
EXPECT_GE
(
src
.
at
<
float
>
(
i
),
min
)
<<
"Value should be >= 0"
;
EXPECT_LE
(
src
.
at
<
float
>
(
i
),
max
)
<<
"Value should be <= 400"
;
}
}
TEST
(
MinMaxLoc
,
regression_4955_nans
)
{
cv
::
Mat
one_mat
(
2
,
2
,
CV_32F
,
cv
::
Scalar
(
1
));
...
...
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