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
c22d92c1
Commit
c22d92c1
authored
Feb 26, 2014
by
Alexander Alekhin
Committed by
Andrey Pavlenko
Apr 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stitching: extend logging
parent
a7f69a37
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
2 deletions
+66
-2
blenders.cpp
modules/stitching/src/blenders.cpp
+23
-2
stitcher.cpp
modules/stitching/src/stitcher.cpp
+43
-0
No files found.
modules/stitching/src/blenders.cpp
View file @
c22d92c1
...
...
@@ -248,7 +248,11 @@ void MultiBandBlender::prepare(Rect dst_roi)
void
MultiBandBlender
::
feed
(
InputArray
_img
,
InputArray
mask
,
Point
tl
)
{
Mat
img
=
_img
.
getMat
();
#if ENABLE_LOG
int64
t
=
getTickCount
();
#endif
UMat
img
=
_img
.
getUMat
();
CV_Assert
(
img
.
type
()
==
CV_16SC3
||
img
.
type
()
==
CV_8UC3
);
CV_Assert
(
mask
.
type
()
==
CV_8U
);
...
...
@@ -286,12 +290,22 @@ void MultiBandBlender::feed(InputArray _img, InputArray mask, Point tl)
UMat
img_with_border
;
copyMakeBorder
(
_img
,
img_with_border
,
top
,
bottom
,
left
,
right
,
BORDER_REFLECT
);
LOGLN
(
" Add border to the source image, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
#if ENABLE_LOG
t
=
getTickCount
();
#endif
std
::
vector
<
UMat
>
src_pyr_laplace
;
if
(
can_use_gpu_
&&
img_with_border
.
depth
()
==
CV_16S
)
createLaplacePyrGpu
(
img_with_border
,
num_bands_
,
src_pyr_laplace
);
else
createLaplacePyr
(
img_with_border
,
num_bands_
,
src_pyr_laplace
);
LOGLN
(
" Create the source image Laplacian pyramid, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
#if ENABLE_LOG
t
=
getTickCount
();
#endif
// Create the weight map Gaussian pyramid
UMat
weight_map
;
std
::
vector
<
UMat
>
weight_pyr_gauss
(
num_bands_
+
1
);
...
...
@@ -313,6 +327,11 @@ void MultiBandBlender::feed(InputArray _img, InputArray mask, Point tl)
for
(
int
i
=
0
;
i
<
num_bands_
;
++
i
)
pyrDown
(
weight_pyr_gauss
[
i
],
weight_pyr_gauss
[
i
+
1
]);
LOGLN
(
" Create the weight map Gaussian pyramid, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
#if ENABLE_LOG
t
=
getTickCount
();
#endif
int
y_tl
=
tl_new
.
y
-
dst_roi_
.
y
;
int
y_br
=
br_new
.
y
-
dst_roi_
.
y
;
int
x_tl
=
tl_new
.
x
-
dst_roi_
.
x
;
...
...
@@ -348,7 +367,7 @@ void MultiBandBlender::feed(InputArray _img, InputArray mask, Point tl)
x_br
/=
2
;
y_br
/=
2
;
}
}
else
// weight_type_ == CV_16S
else
// weight_type_ == CV_16S
{
for
(
int
i
=
0
;
i
<=
num_bands_
;
++
i
)
{
...
...
@@ -377,6 +396,8 @@ void MultiBandBlender::feed(InputArray _img, InputArray mask, Point tl)
x_br
/=
2
;
y_br
/=
2
;
}
}
LOGLN
(
" Add weighted layer of the source image to the final Laplacian pyramid layer, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
}
...
...
modules/stitching/src/stitcher.cpp
View file @
c22d92c1
...
...
@@ -220,6 +220,9 @@ Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArra
for
(
size_t
img_idx
=
0
;
img_idx
<
imgs_
.
size
();
++
img_idx
)
{
LOGLN
(
"Compositing image #"
<<
indices_
[
img_idx
]
+
1
);
#if ENABLE_LOG
int64
compositing_t
=
getTickCount
();
#endif
// Read image and resize it if necessary
full_img
=
imgs_
[
img_idx
];
...
...
@@ -261,25 +264,48 @@ Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArra
}
}
if
(
std
::
abs
(
compose_scale
-
1
)
>
1e-1
)
{
#if ENABLE_LOG
int64
resize_t
=
getTickCount
();
#endif
resize
(
full_img
,
img
,
Size
(),
compose_scale
,
compose_scale
);
LOGLN
(
" resize time: "
<<
((
getTickCount
()
-
resize_t
)
/
getTickFrequency
())
<<
" sec"
);
}
else
img
=
full_img
;
full_img
.
release
();
Size
img_size
=
img
.
size
();
LOGLN
(
" after resize time: "
<<
((
getTickCount
()
-
compositing_t
)
/
getTickFrequency
())
<<
" sec"
);
Mat
K
;
cameras_
[
img_idx
].
K
().
convertTo
(
K
,
CV_32F
);
#if ENABLE_LOG
int64
pt
=
getTickCount
();
#endif
// Warp the current image
w
->
warp
(
img
,
K
,
cameras_
[
img_idx
].
R
,
INTER_LINEAR
,
BORDER_CONSTANT
,
img_warped
);
LOGLN
(
" warp the current image: "
<<
((
getTickCount
()
-
pt
)
/
getTickFrequency
())
<<
" sec"
);
#if ENABLE_LOG
pt
=
getTickCount
();
#endif
// Warp the current image mask
mask
.
create
(
img_size
,
CV_8U
);
mask
.
setTo
(
Scalar
::
all
(
255
));
w
->
warp
(
mask
,
K
,
cameras_
[
img_idx
].
R
,
INTER_NEAREST
,
BORDER_CONSTANT
,
mask_warped
);
LOGLN
(
" warp the current image mask: "
<<
((
getTickCount
()
-
pt
)
/
getTickFrequency
())
<<
" sec"
);
#if ENABLE_LOG
pt
=
getTickCount
();
#endif
// Compensate exposure
exposure_comp_
->
apply
((
int
)
img_idx
,
corners
[
img_idx
],
img_warped
,
mask_warped
);
LOGLN
(
" compensate exposure: "
<<
((
getTickCount
()
-
pt
)
/
getTickFrequency
())
<<
" sec"
);
#if ENABLE_LOG
pt
=
getTickCount
();
#endif
img_warped
.
convertTo
(
img_warped_s
,
CV_16S
);
img_warped
.
release
();
...
...
@@ -292,18 +318,35 @@ Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArra
bitwise_and
(
seam_mask
,
mask_warped
,
mask_warped
);
LOGLN
(
" other: "
<<
((
getTickCount
()
-
pt
)
/
getTickFrequency
())
<<
" sec"
);
#if ENABLE_LOG
pt
=
getTickCount
();
#endif
if
(
!
is_blender_prepared
)
{
blender_
->
prepare
(
corners
,
sizes
);
is_blender_prepared
=
true
;
}
LOGLN
(
" other2: "
<<
((
getTickCount
()
-
pt
)
/
getTickFrequency
())
<<
" sec"
);
LOGLN
(
" feed..."
);
#if ENABLE_LOG
int64
feed_t
=
getTickCount
();
#endif
// Blend the current image
blender_
->
feed
(
img_warped_s
,
mask_warped
,
corners
[
img_idx
]);
LOGLN
(
" feed time: "
<<
((
getTickCount
()
-
feed_t
)
/
getTickFrequency
())
<<
" sec"
);
LOGLN
(
"Compositing ## time: "
<<
((
getTickCount
()
-
compositing_t
)
/
getTickFrequency
())
<<
" sec"
);
}
#if ENABLE_LOG
int64
blend_t
=
getTickCount
();
#endif
UMat
result
,
result_mask
;
blender_
->
blend
(
result
,
result_mask
);
LOGLN
(
"blend time: "
<<
((
getTickCount
()
-
blend_t
)
/
getTickFrequency
())
<<
" sec"
);
LOGLN
(
"Compositing, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
...
...
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