Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
2cb08d7f
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2cb08d7f
编写于
5月 19, 2011
作者:
A
Alexey Spizhevoy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added time measurements into opencv_stitching
上级
2dc981aa
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
6 deletion
+29
-6
modules/stitching/main.cpp
modules/stitching/main.cpp
+27
-4
modules/stitching/motion_estimators.cpp
modules/stitching/motion_estimators.cpp
+2
-2
未找到文件。
modules/stitching/main.cpp
浏览文件 @
2cb08d7f
...
...
@@ -30,6 +30,7 @@ void printUsage()
int
main
(
int
argc
,
char
*
argv
[])
{
int64
app_start_time
=
getTickCount
();
cv
::
setBreakOnError
(
true
);
vector
<
string
>
img_names
;
...
...
@@ -65,6 +66,8 @@ int main(int argc, char* argv[])
}
}
int64
t
=
getTickCount
();
LOGLN
(
"Parsing params and reading images..."
);
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
string
(
argv
[
i
])
==
"--trygpu"
)
...
...
@@ -203,6 +206,7 @@ int main(int argc, char* argv[])
}
}
}
LOGLN
(
"Parsing params and reading images, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
int
num_images
=
static_cast
<
int
>
(
images
.
size
());
if
(
num_images
<
2
)
...
...
@@ -211,17 +215,21 @@ int main(int argc, char* argv[])
return
-
1
;
}
t
=
getTickCount
();
LOGLN
(
"Finding features..."
);
vector
<
ImageFeatures
>
features
;
SurfFeaturesFinder
finder
(
trygpu
);
finder
(
images
,
features
);
LOGLN
(
"Finding features, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
LOGLN
(
"Pairwise matching..."
);
t
=
getTickCount
();
LOGLN
(
"Pairwise matching... "
);
vector
<
MatchesInfo
>
pairwise_matches
;
BestOf2NearestMatcher
matcher
(
trygpu
);
if
(
user_match_conf
)
matcher
=
BestOf2NearestMatcher
(
trygpu
,
match_conf
);
matcher
(
images
,
features
,
pairwise_matches
);
LOGLN
(
"Pairwise matching, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
vector
<
int
>
indices
=
leaveBiggestComponent
(
images
,
features
,
pairwise_matches
,
conf_thresh
);
vector
<
string
>
img_names_subset
;
...
...
@@ -236,10 +244,12 @@ int main(int argc, char* argv[])
return
-
1
;
}
t
=
getTickCount
();
LOGLN
(
"Estimating rotations..."
);
HomographyBasedEstimator
estimator
;
vector
<
CameraParams
>
cameras
;
estimator
(
images
,
features
,
pairwise_matches
,
cameras
);
LOGLN
(
"Estimating rotations, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
for
(
size_t
i
=
0
;
i
<
cameras
.
size
();
++
i
)
{
...
...
@@ -249,12 +259,15 @@ int main(int argc, char* argv[])
LOGLN
(
"Initial focal length "
<<
i
<<
": "
<<
cameras
[
i
].
focal
);
}
LOGLN
(
"Bundle adjustment..."
);
t
=
getTickCount
();
LOGLN
(
"Bundle adjustment... "
);
BundleAdjuster
adjuster
(
ba_space
,
conf_thresh
);
adjuster
(
images
,
features
,
pairwise_matches
,
cameras
);
LOGLN
(
"Bundle adjustment, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
if
(
wave_correct
)
{
t
=
getTickCount
();
LOGLN
(
"Wave correcting..."
);
vector
<
Mat
>
rmats
;
for
(
size_t
i
=
0
;
i
<
cameras
.
size
();
++
i
)
...
...
@@ -262,6 +275,7 @@ int main(int argc, char* argv[])
waveCorrect
(
rmats
);
for
(
size_t
i
=
0
;
i
<
cameras
.
size
();
++
i
)
cameras
[
i
].
R
=
rmats
[
i
];
LOGLN
(
"Wave correcting, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
}
// Find median focal length
...
...
@@ -277,6 +291,8 @@ int main(int argc, char* argv[])
if
((
work_megapix
>
0
||
compose_megapix
>
0
)
&&
abs
(
work_megapix
-
compose_megapix
)
>
1e-3
)
{
t
=
getTickCount
();
LOGLN
(
"Compose scaling..."
);
for
(
int
i
=
0
;
i
<
num_images
;
++
i
)
{
Mat
full_img
=
imread
(
img_names
[
i
]);
...
...
@@ -291,6 +307,7 @@ int main(int argc, char* argv[])
cameras
[
i
].
focal
*=
compose_scale
/
work_scale
;
}
camera_focal
*=
static_cast
<
float
>
(
compose_scale
/
work_scale
);
LOGLN
(
"Compose scaling, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
}
vector
<
Mat
>
masks
(
num_images
);
...
...
@@ -304,7 +321,8 @@ int main(int argc, char* argv[])
vector
<
Mat
>
masks_warped
(
num_images
);
vector
<
Mat
>
images_warped
(
num_images
);
LOGLN
(
"Warping images..."
);
t
=
getTickCount
();
LOGLN
(
"Warping images... "
);
Ptr
<
Warper
>
warper
=
Warper
::
createByCameraFocal
(
camera_focal
,
warp_type
);
for
(
int
i
=
0
;
i
<
num_images
;
++
i
)
{
...
...
@@ -314,19 +332,24 @@ int main(int argc, char* argv[])
vector
<
Mat
>
images_f
(
num_images
);
for
(
int
i
=
0
;
i
<
num_images
;
++
i
)
images_warped
[
i
].
convertTo
(
images_f
[
i
],
CV_32F
);
LOGLN
(
"Warping images, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
t
=
getTickCount
();
LOGLN
(
"Finding seams..."
);
Ptr
<
SeamFinder
>
seam_finder
=
SeamFinder
::
createDefault
(
seam_find_type
);
(
*
seam_finder
)(
images_f
,
corners
,
masks_warped
);
LOGLN
(
"Finding seams, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
t
=
getTickCount
();
LOGLN
(
"Blending images..."
);
Mat
result
,
result_mask
;
Ptr
<
Blender
>
blender
=
Blender
::
createDefault
(
blend_type
);
(
*
blender
)(
images_f
,
corners
,
masks_warped
,
result
,
result_mask
);
LOGLN
(
"Blending images, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
imwrite
(
result_name
,
result
);
LOGLN
(
"Finished"
);
LOGLN
(
"Finished
, total time: "
<<
((
getTickCount
()
-
app_start_time
)
/
getTickFrequency
())
<<
" sec
"
);
return
0
;
}
modules/stitching/motion_estimators.cpp
浏览文件 @
2cb08d7f
...
...
@@ -165,8 +165,8 @@ void BundleAdjuster::estimate(const vector<Mat> &images, const vector<ImageFeatu
cvCopy
(
&
matErr
,
_err
);
}
}
LOGLN
(
"B
A
final error: "
<<
sqrt
(
err_
.
dot
(
err_
)));
LOGLN
(
"B
A iterations
done: "
<<
count
);
LOGLN
(
"B
undle adjustment,
final error: "
<<
sqrt
(
err_
.
dot
(
err_
)));
LOGLN
(
"B
undle adjustment, iteration
done: "
<<
count
);
// Obtain global motion
for
(
int
i
=
0
;
i
<
num_images_
;
++
i
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录