Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
4a53199e
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
4a53199e
编写于
10月 09, 2012
作者:
A
Andrey Kamaev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Quiet logs in stitching module
上级
7cc67701
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
19 deletion
+41
-19
modules/stitching/include/opencv2/stitching/detail/util.hpp
modules/stitching/include/opencv2/stitching/detail/util.hpp
+1
-1
modules/stitching/src/exposure_compensate.cpp
modules/stitching/src/exposure_compensate.cpp
+2
-0
modules/stitching/src/motion_estimators.cpp
modules/stitching/src/motion_estimators.cpp
+6
-0
modules/stitching/src/seam_finders.cpp
modules/stitching/src/seam_finders.cpp
+24
-18
modules/stitching/src/stitcher.cpp
modules/stitching/src/stitcher.cpp
+8
-0
未找到文件。
modules/stitching/include/opencv2/stitching/detail/util.hpp
浏览文件 @
4a53199e
...
...
@@ -46,7 +46,7 @@
#include <list>
#include "opencv2/core/core.hpp"
#define ENABLE_LOG
1
#define ENABLE_LOG
0
// TODO remove LOG macros, add logging class
#if ENABLE_LOG
...
...
modules/stitching/src/exposure_compensate.cpp
浏览文件 @
4a53199e
...
...
@@ -74,7 +74,9 @@ void GainCompensator::feed(const vector<Point> &corners, const vector<Mat> &imag
const
vector
<
pair
<
Mat
,
uchar
>
>
&
masks
)
{
LOGLN
(
"Exposure compensation..."
);
#if ENABLE_LOG
int64
t
=
getTickCount
();
#endif
CV_Assert
(
corners
.
size
()
==
images
.
size
()
&&
images
.
size
()
==
masks
.
size
());
...
...
modules/stitching/src/motion_estimators.cpp
浏览文件 @
4a53199e
...
...
@@ -105,7 +105,9 @@ void HomographyBasedEstimator::estimate(const vector<ImageFeatures> &features, c
vector
<
CameraParams
>
&
cameras
)
{
LOGLN
(
"Estimating rotations..."
);
#if ENABLE_LOG
int64
t
=
getTickCount
();
#endif
const
int
num_images
=
static_cast
<
int
>
(
features
.
size
());
...
...
@@ -172,7 +174,9 @@ void BundleAdjusterBase::estimate(const vector<ImageFeatures> &features,
vector
<
CameraParams
>
&
cameras
)
{
LOG_CHAT
(
"Bundle adjustment"
);
#if ENABLE_LOG
int64
t
=
getTickCount
();
#endif
num_images_
=
static_cast
<
int
>
(
features
.
size
());
features_
=
&
features
[
0
];
...
...
@@ -582,7 +586,9 @@ void BundleAdjusterRay::calcJacobian(Mat &jac)
void
waveCorrect
(
vector
<
Mat
>
&
rmats
,
WaveCorrectKind
kind
)
{
LOGLN
(
"Wave correcting..."
);
#if ENABLE_LOG
int64
t
=
getTickCount
();
#endif
Mat
moment
=
Mat
::
zeros
(
3
,
3
,
CV_32F
);
for
(
size_t
i
=
0
;
i
<
rmats
.
size
();
++
i
)
...
...
modules/stitching/src/seam_finders.cpp
浏览文件 @
4a53199e
...
...
@@ -52,10 +52,12 @@ void PairwiseSeamFinder::find(const vector<Mat> &src, const vector<Point> &corne
vector
<
Mat
>
&
masks
)
{
LOGLN
(
"Finding seams..."
);
if
(
src
.
size
()
==
0
)
if
(
src
.
size
()
==
0
)
return
;
#if ENABLE_LOG
int64
t
=
getTickCount
();
#endif
images_
=
src
;
sizes_
.
resize
(
src
.
size
());
...
...
@@ -87,10 +89,12 @@ void VoronoiSeamFinder::find(const vector<Size> &sizes, const vector<Point> &cor
vector
<
Mat
>
&
masks
)
{
LOGLN
(
"Finding seams..."
);
if
(
sizes
.
size
()
==
0
)
if
(
sizes
.
size
()
==
0
)
return
;
#if ENABLE_LOG
int64
t
=
getTickCount
();
#endif
sizes_
=
sizes
;
corners_
=
corners
;
...
...
@@ -161,7 +165,9 @@ DpSeamFinder::DpSeamFinder(CostFunction costFunc) : costFunc_(costFunc) {}
void
DpSeamFinder
::
find
(
const
vector
<
Mat
>
&
src
,
const
vector
<
Point
>
&
corners
,
vector
<
Mat
>
&
masks
)
{
LOGLN
(
"Finding seams..."
);
#if ENABLE_LOG
int64
t
=
getTickCount
();
#endif
if
(
src
.
size
()
==
0
)
return
;
...
...
@@ -700,7 +706,7 @@ void DpSeamFinder::computeCosts(
{
CV_Assert
(
states_
[
comp
]
&
INTERS
);
// compute costs
// compute costs
float
(
*
diff
)(
const
Mat
&
,
int
,
int
,
const
Mat
&
,
int
,
int
)
=
0
;
if
(
image1
.
type
()
==
CV_32FC3
&&
image2
.
type
()
==
CV_32FC3
)
...
...
@@ -1055,10 +1061,10 @@ public:
void
findInPair
(
size_t
first
,
size_t
second
,
Rect
roi
);
private:
void
setGraphWeightsColor
(
const
Mat
&
img1
,
const
Mat
&
img2
,
void
setGraphWeightsColor
(
const
Mat
&
img1
,
const
Mat
&
img2
,
const
Mat
&
mask1
,
const
Mat
&
mask2
,
GCGraph
<
float
>
&
graph
);
void
setGraphWeightsColorGrad
(
const
Mat
&
img1
,
const
Mat
&
img2
,
const
Mat
&
dx1
,
const
Mat
&
dx2
,
const
Mat
&
dy1
,
const
Mat
&
dy2
,
const
Mat
&
mask1
,
const
Mat
&
mask2
,
void
setGraphWeightsColorGrad
(
const
Mat
&
img1
,
const
Mat
&
img2
,
const
Mat
&
dx1
,
const
Mat
&
dx2
,
const
Mat
&
dy1
,
const
Mat
&
dy2
,
const
Mat
&
mask1
,
const
Mat
&
mask2
,
GCGraph
<
float
>
&
graph
);
vector
<
Mat
>
dx_
,
dy_
;
...
...
@@ -1148,8 +1154,8 @@ void GraphCutSeamFinder::Impl::setGraphWeightsColor(const Mat &img1, const Mat &
void
GraphCutSeamFinder
::
Impl
::
setGraphWeightsColorGrad
(
const
Mat
&
img1
,
const
Mat
&
img2
,
const
Mat
&
dx1
,
const
Mat
&
dx2
,
const
Mat
&
dy1
,
const
Mat
&
dy2
,
const
Mat
&
mask1
,
const
Mat
&
mask2
,
const
Mat
&
img1
,
const
Mat
&
img2
,
const
Mat
&
dx1
,
const
Mat
&
dx2
,
const
Mat
&
dy1
,
const
Mat
&
dy2
,
const
Mat
&
mask1
,
const
Mat
&
mask2
,
GCGraph
<
float
>
&
graph
)
{
const
Size
img_size
=
img1
.
size
();
...
...
@@ -1177,7 +1183,7 @@ void GraphCutSeamFinder::Impl::setGraphWeightsColorGrad(
float
grad
=
dx1
.
at
<
float
>
(
y
,
x
)
+
dx1
.
at
<
float
>
(
y
,
x
+
1
)
+
dx2
.
at
<
float
>
(
y
,
x
)
+
dx2
.
at
<
float
>
(
y
,
x
+
1
)
+
weight_eps
;
float
weight
=
(
normL2
(
img1
.
at
<
Point3f
>
(
y
,
x
),
img2
.
at
<
Point3f
>
(
y
,
x
))
+
normL2
(
img1
.
at
<
Point3f
>
(
y
,
x
+
1
),
img2
.
at
<
Point3f
>
(
y
,
x
+
1
)))
/
grad
+
normL2
(
img1
.
at
<
Point3f
>
(
y
,
x
+
1
),
img2
.
at
<
Point3f
>
(
y
,
x
+
1
)))
/
grad
+
weight_eps
;
if
(
!
mask1
.
at
<
uchar
>
(
y
,
x
)
||
!
mask1
.
at
<
uchar
>
(
y
,
x
+
1
)
||
!
mask2
.
at
<
uchar
>
(
y
,
x
)
||
!
mask2
.
at
<
uchar
>
(
y
,
x
+
1
))
...
...
@@ -1186,10 +1192,10 @@ void GraphCutSeamFinder::Impl::setGraphWeightsColorGrad(
}
if
(
y
<
img_size
.
height
-
1
)
{
float
grad
=
dy1
.
at
<
float
>
(
y
,
x
)
+
dy1
.
at
<
float
>
(
y
+
1
,
x
)
+
float
grad
=
dy1
.
at
<
float
>
(
y
,
x
)
+
dy1
.
at
<
float
>
(
y
+
1
,
x
)
+
dy2
.
at
<
float
>
(
y
,
x
)
+
dy2
.
at
<
float
>
(
y
+
1
,
x
)
+
weight_eps
;
float
weight
=
(
normL2
(
img1
.
at
<
Point3f
>
(
y
,
x
),
img2
.
at
<
Point3f
>
(
y
,
x
))
+
normL2
(
img1
.
at
<
Point3f
>
(
y
+
1
,
x
),
img2
.
at
<
Point3f
>
(
y
+
1
,
x
)))
/
grad
+
float
weight
=
(
normL2
(
img1
.
at
<
Point3f
>
(
y
,
x
),
img2
.
at
<
Point3f
>
(
y
,
x
))
+
normL2
(
img1
.
at
<
Point3f
>
(
y
+
1
,
x
),
img2
.
at
<
Point3f
>
(
y
+
1
,
x
)))
/
grad
+
weight_eps
;
if
(
!
mask1
.
at
<
uchar
>
(
y
,
x
)
||
!
mask1
.
at
<
uchar
>
(
y
+
1
,
x
)
||
!
mask2
.
at
<
uchar
>
(
y
,
x
)
||
!
mask2
.
at
<
uchar
>
(
y
+
1
,
x
))
...
...
@@ -1271,7 +1277,7 @@ void GraphCutSeamFinder::Impl::findInPair(size_t first, size_t second, Rect roi)
setGraphWeightsColor
(
subimg1
,
subimg2
,
submask1
,
submask2
,
graph
);
break
;
case
GraphCutSeamFinder
::
COST_COLOR_GRAD
:
setGraphWeightsColorGrad
(
subimg1
,
subimg2
,
subdx1
,
subdx2
,
subdy1
,
subdy2
,
setGraphWeightsColorGrad
(
subimg1
,
subimg2
,
subdx1
,
subdx2
,
subdy1
,
subdy2
,
submask1
,
submask2
,
graph
);
break
;
default:
...
...
@@ -1402,17 +1408,17 @@ void GraphCutSeamFinderGpu::findInPair(size_t first, size_t second, Rect roi)
}
}
}
Mat
terminals
,
leftT
,
rightT
,
top
,
bottom
;
switch
(
cost_type_
)
{
case
GraphCutSeamFinder
::
COST_COLOR
:
setGraphWeightsColor
(
subimg1
,
subimg2
,
submask1
,
submask2
,
setGraphWeightsColor
(
subimg1
,
subimg2
,
submask1
,
submask2
,
terminals
,
leftT
,
rightT
,
top
,
bottom
);
break
;
case
GraphCutSeamFinder
::
COST_COLOR_GRAD
:
setGraphWeightsColorGrad
(
subimg1
,
subimg2
,
subdx1
,
subdx2
,
subdy1
,
subdy2
,
setGraphWeightsColorGrad
(
subimg1
,
subimg2
,
subdx1
,
subdx2
,
subdy1
,
subdy2
,
submask1
,
submask2
,
terminals
,
leftT
,
rightT
,
top
,
bottom
);
break
;
default:
...
...
@@ -1448,7 +1454,7 @@ void GraphCutSeamFinderGpu::findInPair(size_t first, size_t second, Rect roi)
}
void
GraphCutSeamFinderGpu
::
setGraphWeightsColor
(
const
Mat
&
img1
,
const
Mat
&
img2
,
const
Mat
&
mask1
,
const
Mat
&
mask2
,
void
GraphCutSeamFinderGpu
::
setGraphWeightsColor
(
const
Mat
&
img1
,
const
Mat
&
img2
,
const
Mat
&
mask1
,
const
Mat
&
mask2
,
Mat
&
terminals
,
Mat
&
leftT
,
Mat
&
rightT
,
Mat
&
top
,
Mat
&
bottom
)
{
const
Size
img_size
=
img1
.
size
();
...
...
@@ -1540,7 +1546,7 @@ void GraphCutSeamFinderGpu::setGraphWeightsColor(const Mat &img1, const Mat &img
void
GraphCutSeamFinderGpu
::
setGraphWeightsColorGrad
(
const
Mat
&
img1
,
const
Mat
&
img2
,
const
Mat
&
dx1
,
const
Mat
&
dx2
,
const
Mat
&
dy1
,
const
Mat
&
dy2
,
const
Mat
&
mask1
,
const
Mat
&
mask2
,
const
Mat
&
dy1
,
const
Mat
&
dy2
,
const
Mat
&
mask1
,
const
Mat
&
mask2
,
Mat
&
terminals
,
Mat
&
leftT
,
Mat
&
rightT
,
Mat
&
top
,
Mat
&
bottom
)
{
const
Size
img_size
=
img1
.
size
();
...
...
modules/stitching/src/stitcher.cpp
浏览文件 @
4a53199e
...
...
@@ -152,7 +152,9 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
Mat
&
pano_
=
pano
.
getMatRef
();
#if ENABLE_LOG
int64
t
=
getTickCount
();
#endif
vector
<
Point
>
corners
(
imgs_
.
size
());
vector
<
Mat
>
masks_warped
(
imgs_
.
size
());
...
...
@@ -201,7 +203,9 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
masks
.
clear
();
LOGLN
(
"Compositing..."
);
#if ENABLE_LOG
t
=
getTickCount
();
#endif
Mat
img_warped
,
img_warped_s
;
Mat
dilated_mask
,
seam_mask
,
mask
,
mask_warped
;
...
...
@@ -349,7 +353,9 @@ Stitcher::Status Stitcher::matchImages()
full_img_sizes_
.
resize
(
imgs_
.
size
());
LOGLN
(
"Finding features..."
);
#if ENABLE_LOG
int64
t
=
getTickCount
();
#endif
for
(
size_t
i
=
0
;
i
<
imgs_
.
size
();
++
i
)
{
...
...
@@ -406,7 +412,9 @@ Stitcher::Status Stitcher::matchImages()
LOGLN
(
"Finding features, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
LOG
(
"Pairwise matching"
);
#if ENABLE_LOG
t
=
getTickCount
();
#endif
(
*
features_matcher_
)(
features_
,
pairwise_matches_
,
matching_mask_
);
features_matcher_
->
collectGarbage
();
LOGLN
(
"Pairwise matching, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录