Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
be70e0b7
Commit
be70e0b7
authored
Nov 25, 2016
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for maxValue bug in SimpleWB
parent
cb126467
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
8 deletions
+31
-8
simple_color_balance.cpp
modules/xphoto/test/simple_color_balance.cpp
+30
-7
test_grayworld.cpp
modules/xphoto/test/test_grayworld.cpp
+1
-1
No files found.
modules/xphoto/test/simple_color_balance.cpp
View file @
be70e0b7
...
...
@@ -5,8 +5,7 @@ namespace cvtest
TEST
(
xphoto_simplecolorbalance
,
regression
)
{
cv
::
String
dir
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"cv/xphoto/simple_white_balance/"
;
int
nTests
=
12
;
float
threshold
=
0.005
f
;
int
nTests
=
8
;
cv
::
Ptr
<
cv
::
xphoto
::
WhiteBalancer
>
wb
=
cv
::
xphoto
::
createSimpleWB
();
for
(
int
i
=
0
;
i
<
nTests
;
++
i
)
...
...
@@ -15,17 +14,41 @@ namespace cvtest
cv
::
Mat
src
=
cv
::
imread
(
srcName
,
1
);
ASSERT_TRUE
(
!
src
.
empty
());
cv
::
String
previousResultName
=
dir
+
cv
::
format
(
"results/%02d.
pn
g"
,
i
+
1
);
cv
::
String
previousResultName
=
dir
+
cv
::
format
(
"results/%02d.
jp
g"
,
i
+
1
);
cv
::
Mat
previousResult
=
cv
::
imread
(
previousResultName
,
1
);
cv
::
Mat
currentResult
;
wb
->
balanceWhite
(
src
,
currentResult
);
cv
::
Mat
sqrError
=
(
currentResult
-
previousResult
)
.
mul
(
currentResult
-
previousResult
);
cv
::
Scalar
mse
=
cv
::
sum
(
sqrError
)
/
cv
::
Scalar
::
all
(
double
(
sqrError
.
total
()
*
sqrError
.
channels
()
)
);
double
psnr
=
cv
::
PSNR
(
currentResult
,
previousResult
);
EXPECT_
LE
(
mse
[
0
]
+
mse
[
1
]
+
mse
[
2
]
+
mse
[
3
],
threshold
);
EXPECT_
GE
(
psnr
,
30
);
}
}
TEST
(
xphoto_simplecolorbalance
,
max_value
)
{
const
float
oldMax
=
24000.
,
newMax
=
65536.
;
Mat
test
=
Mat
::
zeros
(
3
,
3
,
CV_32FC1
);
test
.
at
<
float
>
(
0
,
0
)
=
oldMax
;
test
.
at
<
float
>
(
0
,
1
)
=
oldMax
/
2
;
test
.
at
<
float
>
(
0
,
2
)
=
oldMax
/
4
;
double
minSrc
,
maxSrc
;
cv
::
minMaxIdx
(
test
,
&
minSrc
,
&
maxSrc
);
cv
::
Ptr
<
cv
::
xphoto
::
SimpleWB
>
wb
=
cv
::
xphoto
::
createSimpleWB
();
wb
->
setInputMin
((
float
)
minSrc
);
wb
->
setInputMax
((
float
)
maxSrc
);
wb
->
setOutputMin
(
0
);
wb
->
setOutputMax
(
newMax
);
wb
->
balanceWhite
(
test
,
test
);
double
minDst
,
maxDst
;
cv
::
minMaxIdx
(
test
,
&
minDst
,
&
maxDst
);
ASSERT_NEAR
(
maxDst
,
newMax
,
newMax
*
1e-4
);
}
}
modules/xphoto/test/test_grayworld.cpp
View file @
be70e0b7
...
...
@@ -66,7 +66,7 @@ namespace cvtest {
TEST
(
xphoto_grayworld_white_balance
,
regression
)
{
String
dir
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"cv/xphoto/simple_white_balance/"
;
const
int
nTests
=
14
;
const
int
nTests
=
8
;
const
float
wb_thresh
=
0.5
f
;
const
float
acc_thresh
=
2.
f
;
Ptr
<
xphoto
::
GrayworldWB
>
wb
=
xphoto
::
createGrayworldWB
();
...
...
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