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
fb177183
Commit
fb177183
authored
May 30, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added --blend_strength parameter into opencv_stitching
parent
8a613758
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
13 deletions
+25
-13
exposure_compensate.cpp
modules/stitching/exposure_compensate.cpp
+3
-2
main.cpp
modules/stitching/main.cpp
+21
-10
motion_estimators.cpp
modules/stitching/motion_estimators.cpp
+1
-1
No files found.
modules/stitching/exposure_compensate.cpp
View file @
fb177183
...
...
@@ -197,6 +197,9 @@ void BlocksGainCompensator::feed(const vector<Point> &corners, const vector<Mat>
vector
<
double
>
gains
=
compensator
.
gains
();
gain_maps_
.
resize
(
num_images
);
Mat_
<
float
>
ker
(
1
,
3
);
ker
(
0
,
0
)
=
0.25
;
ker
(
0
,
1
)
=
0.5
;
ker
(
0
,
2
)
=
0.25
;
int
bl_idx
=
0
;
for
(
int
img_idx
=
0
;
img_idx
<
num_images
;
++
img_idx
)
{
...
...
@@ -207,8 +210,6 @@ void BlocksGainCompensator::feed(const vector<Point> &corners, const vector<Mat>
for
(
int
bx
=
0
;
bx
<
bl_per_img
.
width
;
++
bx
,
++
bl_idx
)
gain_maps_
[
img_idx
](
by
,
bx
)
=
static_cast
<
float
>
(
gains
[
bl_idx
]);
Mat_
<
float
>
ker
(
1
,
3
);
ker
(
0
,
0
)
=
0.25
;
ker
(
0
,
1
)
=
0.5
;
ker
(
0
,
2
)
=
0.25
;
sepFilter2D
(
gain_maps_
[
img_idx
],
gain_maps_
[
img_idx
],
CV_32F
,
ker
,
ker
);
sepFilter2D
(
gain_maps_
[
img_idx
],
gain_maps_
[
img_idx
],
CV_32F
,
ker
,
ker
);
}
...
...
modules/stitching/main.cpp
View file @
fb177183
...
...
@@ -94,11 +94,11 @@ void printUsage()
" Resolution for compositing step. Use -1 for original resolution.
\n
"
" The default is -1.
\n
"
" --expos_comp (no|gain|gain_blocks)
\n
"
" Exposure compensation method. The default is 'gain'.
\n
"
" Exposure compensation method. The default is 'gain
_blocks
'.
\n
"
" --blend (no|feather|multiband)
\n
"
" Blending method. The default is 'multiband'.
\n
"
" --
num_bands <in
t>
\n
"
"
Number of bands for multi-band blending method
. The default is 5.
\n
"
" --
blend_strength <floa
t>
\n
"
"
Blend strength from [0,100] range
. The default is 5.
\n
"
" --output <result_img>
\n
"
;
}
...
...
@@ -114,11 +114,11 @@ int ba_space = BundleAdjuster::FOCAL_RAY_SPACE;
float
conf_thresh
=
1.
f
;
bool
wave_correct
=
true
;
int
warp_type
=
Warper
::
SPHERICAL
;
int
expos_comp_type
=
ExposureCompensator
::
GAIN
;
float
match_conf
=
0.
7
f
;
int
expos_comp_type
=
ExposureCompensator
::
GAIN
_BLOCKS
;
float
match_conf
=
0.
65
f
;
int
seam_find_type
=
SeamFinder
::
GC_COLOR
;
int
blend_type
=
Blender
::
MULTI_BAND
;
int
num_bands
=
5
;
float
blend_strength
=
5
;
string
result_name
=
"result.png"
;
int
parseCmdArgs
(
int
argc
,
char
**
argv
)
...
...
@@ -270,9 +270,9 @@ int parseCmdArgs(int argc, char** argv)
}
i
++
;
}
else
if
(
string
(
argv
[
i
])
==
"--
num_bands
"
)
else
if
(
string
(
argv
[
i
])
==
"--
blend_strength
"
)
{
num_bands
=
atoi
(
argv
[
i
+
1
]
);
blend_strength
=
static_cast
<
float
>
(
atof
(
argv
[
i
+
1
])
);
i
++
;
}
else
if
(
string
(
argv
[
i
])
==
"--output"
)
...
...
@@ -562,10 +562,21 @@ int main(int argc, char* argv[])
if
(
static_cast
<
Blender
*>
(
blender
)
==
0
)
{
blender
=
Blender
::
createDefault
(
blend_type
);
if
(
blend_type
==
Blender
::
MULTI_BAND
)
Size
dst_sz
=
resultRoi
(
corners
,
sizes
).
size
();
float
blend_width
=
sqrt
(
static_cast
<
float
>
(
dst_sz
.
area
()))
*
blend_strength
/
100.
f
;
if
(
blend_width
<
1.
f
)
blender
=
Blender
::
createDefault
(
Blender
::
NO
);
else
if
(
blend_type
==
Blender
::
MULTI_BAND
)
{
MultiBandBlender
*
mb
=
dynamic_cast
<
MultiBandBlender
*>
(
static_cast
<
Blender
*>
(
blender
));
mb
->
setNumBands
(
num_bands
);
mb
->
setNumBands
(
static_cast
<
int
>
(
ceil
(
log
(
blend_width
)
/
log
(
2.
))
-
1.
));
LOGLN
(
"Multi-band blender, number of bands: "
<<
mb
->
numBands
());
}
else
if
(
blend_type
==
Blender
::
FEATHER
)
{
FeatherBlender
*
fb
=
dynamic_cast
<
FeatherBlender
*>
(
static_cast
<
Blender
*>
(
blender
));
fb
->
setSharpness
(
1.
f
/
blend_width
);
LOGLN
(
"Feather blender, number of bands: "
<<
fb
->
sharpness
());
}
blender
->
prepare
(
corners
,
sizes
);
}
...
...
modules/stitching/motion_estimators.cpp
View file @
fb177183
...
...
@@ -432,7 +432,7 @@ vector<int> leaveBiggestComponent(vector<ImageFeatures> &features, vector<Match
return
indices
;
LOG
(
"Removed some images, because can't match them: ("
);
LOG
(
indices_removed
[
0
]);
LOG
(
indices_removed
[
0
]
+
1
);
for
(
size_t
i
=
1
;
i
<
indices_removed
.
size
();
++
i
)
LOG
(
", "
<<
indices_removed
[
i
]
+
1
);
LOGLN
(
")"
);
...
...
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