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
6f4012df
Commit
6f4012df
authored
Jan 04, 2018
by
berak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xphoto: fix learning_based_color_balance.cpp
parent
53986aaa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
learning_based_color_balance.cpp
modules/xphoto/src/learning_based_color_balance.cpp
+21
-14
No files found.
modules/xphoto/src/learning_based_color_balance.cpp
View file @
6f4012df
...
...
@@ -95,21 +95,19 @@ class LearningBasedWBImpl : public LearningBasedWB
palette_size
=
300
;
palette_bandwidth
=
0.1
f
;
prediction_thresh
=
0.025
f
;
if
(
path_to_model
.
empty
())
/* try to load model from file */
FileStorage
fs
;
if
(
!
path_to_model
.
empty
()
&&
fs
.
open
(
path_to_model
,
FileStorage
::
READ
))
{
/* use the default model */
num_trees
=
_num_trees
;
num_tree_nodes
=
_num_tree_nodes
;
feature_idx
=
_feature_idx
;
thresh_vals
=
_thresh_vals
;
leaf_vals
=
_leaf_vals
;
}
else
{
/* load model from file */
FileStorage
fs
(
path_to_model
,
0
);
num_trees
=
fs
[
"num_trees"
];
num_tree_nodes
=
fs
[
"num_tree_nodes"
];
if
(
fs
[
"num_trees"
].
isReal
())
{
//workaround for #10506
double
nt
=
fs
[
"num_trees"
];
num_trees
=
int
(
nt
);
double
ntn
=
fs
[
"num_tree_nodes"
];
num_tree_nodes
=
int
(
ntn
);
}
else
{
num_trees
=
fs
[
"num_trees"
];
num_tree_nodes
=
fs
[
"num_tree_nodes"
];
}
fs
[
"feature_idx"
]
>>
feature_idx_Mat
;
fs
[
"thresh_vals"
]
>>
thresh_vals_Mat
;
fs
[
"leaf_vals"
]
>>
leaf_vals_Mat
;
...
...
@@ -117,6 +115,15 @@ class LearningBasedWBImpl : public LearningBasedWB
thresh_vals
=
thresh_vals_Mat
.
ptr
<
float
>
();
leaf_vals
=
leaf_vals_Mat
.
ptr
<
float
>
();
}
else
{
/* use the default model */
num_trees
=
_num_trees
;
num_tree_nodes
=
_num_tree_nodes
;
feature_idx
=
_feature_idx
;
thresh_vals
=
_thresh_vals
;
leaf_vals
=
_leaf_vals
;
}
}
int
getRangeMaxVal
()
const
{
return
range_max_val
;
}
...
...
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