Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
90ece0b8
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,发现更多精彩内容 >>
提交
90ece0b8
编写于
5月 21, 2011
作者:
A
Alexey Spizhevoy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactoring in opencv_stitching
上级
16e6c45e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
15 addition
and
41 deletion
+15
-41
modules/stitching/main.cpp
modules/stitching/main.cpp
+6
-6
modules/stitching/seam_finders.cpp
modules/stitching/seam_finders.cpp
+0
-7
modules/stitching/seam_finders.hpp
modules/stitching/seam_finders.hpp
+3
-10
modules/stitching/warpers.cpp
modules/stitching/warpers.cpp
+1
-8
modules/stitching/warpers.hpp
modules/stitching/warpers.hpp
+4
-9
modules/stitching/warpers_inl.hpp
modules/stitching/warpers_inl.hpp
+1
-1
未找到文件。
modules/stitching/main.cpp
浏览文件 @
90ece0b8
...
...
@@ -52,7 +52,7 @@ int main(int argc, char* argv[])
int
blend_type
=
Blender
::
MULTI_BAND
;
string
result_name
=
"result.png"
;
double
work_scale
=
-
1
,
compose_scale
=
-
1
;
double
work_scale
=
1
,
compose_scale
=
1
;
bool
is_work_scale_set
=
false
,
is_compose_scale_set
=
false
;
if
(
argc
==
1
)
...
...
@@ -328,11 +328,11 @@ int main(int argc, char* argv[])
Ptr
<
Warper
>
warper
=
Warper
::
createByCameraFocal
(
camera_focal
,
warp_type
);
for
(
int
i
=
0
;
i
<
num_images
;
++
i
)
{
corners
[
i
]
=
(
*
warper
)
(
images
[
i
],
static_cast
<
float
>
(
cameras
[
i
].
focal
),
cameras
[
i
].
R
,
images_warped
[
i
]);
corners
[
i
]
=
warper
->
warp
(
images
[
i
],
static_cast
<
float
>
(
cameras
[
i
].
focal
),
cameras
[
i
].
R
,
images_warped
[
i
]);
sizes
[
i
]
=
images_warped
[
i
].
size
();
(
*
warper
)
(
masks
[
i
],
static_cast
<
float
>
(
cameras
[
i
].
focal
),
cameras
[
i
].
R
,
masks_warped
[
i
],
INTER_NEAREST
,
BORDER_CONSTANT
);
warper
->
warp
(
masks
[
i
],
static_cast
<
float
>
(
cameras
[
i
].
focal
),
cameras
[
i
].
R
,
masks_warped
[
i
],
INTER_NEAREST
,
BORDER_CONSTANT
);
}
vector
<
Mat
>
images_f
(
num_images
);
...
...
@@ -344,7 +344,7 @@ int main(int argc, char* argv[])
LOGLN
(
"Finding seams..."
);
t
=
getTickCount
();
Ptr
<
SeamFinder
>
seam_finder
=
SeamFinder
::
createDefault
(
seam_find_type
);
(
*
seam_finder
)
(
images_f
,
corners
,
masks_warped
);
seam_finder
->
find
(
images_f
,
corners
,
masks_warped
);
LOGLN
(
"Finding seams, time: "
<<
((
getTickCount
()
-
t
)
/
getTickFrequency
())
<<
" sec"
);
LOGLN
(
"Blending images..."
);
...
...
modules/stitching/seam_finders.cpp
浏览文件 @
90ece0b8
...
...
@@ -20,13 +20,6 @@ Ptr<SeamFinder> SeamFinder::createDefault(int type)
}
void
SeamFinder
::
operator
()(
const
vector
<
Mat
>
&
src
,
const
vector
<
Point
>
&
corners
,
vector
<
Mat
>
&
masks
)
{
find
(
src
,
corners
,
masks
);
}
void
PairwiseSeamFinder
::
find
(
const
vector
<
Mat
>
&
src
,
const
vector
<
Point
>
&
corners
,
vector
<
Mat
>
&
masks
)
{
...
...
modules/stitching/seam_finders.hpp
浏览文件 @
90ece0b8
...
...
@@ -8,15 +8,9 @@ class SeamFinder
{
public:
enum
{
NO
,
VORONOI
,
GRAPH_CUT
};
static
cv
::
Ptr
<
SeamFinder
>
createDefault
(
int
type
);
virtual
~
SeamFinder
()
{}
void
operator
()(
const
std
::
vector
<
cv
::
Mat
>
&
src
,
const
std
::
vector
<
cv
::
Point
>
&
corners
,
std
::
vector
<
cv
::
Mat
>
&
masks
);
protected:
virtual
void
find
(
const
std
::
vector
<
cv
::
Mat
>
&
src
,
const
std
::
vector
<
cv
::
Point
>
&
corners
,
std
::
vector
<
cv
::
Mat
>
&
masks
)
=
0
;
};
...
...
@@ -24,17 +18,17 @@ protected:
class
NoSeamFinder
:
public
SeamFinder
{
p
rotected
:
p
ublic
:
void
find
(
const
std
::
vector
<
cv
::
Mat
>&
,
const
std
::
vector
<
cv
::
Point
>&
,
std
::
vector
<
cv
::
Mat
>&
)
{}
};
class
PairwiseSeamFinder
:
public
SeamFinder
{
p
rotected
:
p
ublic
:
void
find
(
const
std
::
vector
<
cv
::
Mat
>
&
src
,
const
std
::
vector
<
cv
::
Point
>
&
corners
,
std
::
vector
<
cv
::
Mat
>
&
masks
);
protected:
virtual
void
findInPair
(
const
cv
::
Mat
&
img1
,
const
cv
::
Mat
&
img2
,
cv
::
Point
tl1
,
cv
::
Point
tl2
,
cv
::
Rect
roi
,
cv
::
Mat
&
mask1
,
cv
::
Mat
&
mask2
)
=
0
;
};
...
...
@@ -53,7 +47,6 @@ class GraphCutSeamFinder : public PairwiseSeamFinder
public:
// TODO add COST_COLOR_GRAD support
enum
{
COST_COLOR
};
GraphCutSeamFinder
(
int
cost_type
=
COST_COLOR
,
float
terminal_cost
=
10000.
f
,
float
bad_region_penalty
=
1000.
f
);
...
...
modules/stitching/warpers.cpp
浏览文件 @
90ece0b8
...
...
@@ -16,7 +16,7 @@ Ptr<Warper> Warper::createByCameraFocal(float focal, int type)
}
void
ProjectorBase
::
set
CameraMatrix
(
const
Mat
&
R
)
void
ProjectorBase
::
set
Transformation
(
const
Mat
&
R
)
{
CV_Assert
(
R
.
size
()
==
Size
(
3
,
3
));
CV_Assert
(
R
.
type
()
==
CV_32F
);
...
...
@@ -31,13 +31,6 @@ void ProjectorBase::setCameraMatrix(const Mat &R)
}
Point
Warper
::
operator
()(
const
Mat
&
src
,
float
focal
,
const
Mat
&
R
,
Mat
&
dst
,
int
interp_mode
,
int
border_mode
)
{
return
warp
(
src
,
focal
,
R
,
dst
,
interp_mode
,
border_mode
);
}
void
PlaneWarper
::
detectResultRoi
(
Point
&
dst_tl
,
Point
&
dst_br
)
{
float
tl_uf
=
numeric_limits
<
float
>::
max
();
...
...
modules/stitching/warpers.hpp
浏览文件 @
90ece0b8
...
...
@@ -8,23 +8,17 @@ class Warper
{
public:
enum
{
PLANE
,
CYLINDRICAL
,
SPHERICAL
};
static
cv
::
Ptr
<
Warper
>
createByCameraFocal
(
float
focal
,
int
type
);
virtual
~
Warper
()
{}
cv
::
Point
operator
()(
const
cv
::
Mat
&
src
,
float
focal
,
const
cv
::
Mat
&
R
,
cv
::
Mat
&
dst
,
int
interp_mode
=
cv
::
INTER_LINEAR
,
int
border_mode
=
cv
::
BORDER_REFLECT
);
protected:
virtual
cv
::
Point
warp
(
const
cv
::
Mat
&
src
,
float
focal
,
const
cv
::
Mat
&
R
,
cv
::
Mat
&
dst
,
int
interp_mode
,
int
border_mode
)
=
0
;
int
interp_mode
=
cv
::
INTER_LINEAR
,
int
border_mode
=
cv
::
BORDER_REFLECT
)
=
0
;
};
struct
ProjectorBase
{
void
set
CameraMatrix
(
const
cv
::
Mat
&
R
);
void
set
Transformation
(
const
cv
::
Mat
&
R
);
cv
::
Size
size
;
float
focal
;
...
...
@@ -37,10 +31,11 @@ struct ProjectorBase
template
<
class
P
>
class
WarperBase
:
public
Warper
{
p
rotected
:
p
ublic
:
cv
::
Point
warp
(
const
cv
::
Mat
&
src
,
float
focal
,
const
cv
::
Mat
&
R
,
cv
::
Mat
&
dst
,
int
interp_mode
,
int
border_mode
);
protected:
// Detects ROI of the destination image. It's correct for any projection.
virtual
void
detectResultRoi
(
cv
::
Point
&
dst_tl
,
cv
::
Point
&
dst_br
);
...
...
modules/stitching/warpers_inl.hpp
浏览文件 @
90ece0b8
...
...
@@ -11,7 +11,7 @@ cv::Point WarperBase<P>::warp(const cv::Mat &src, float focal, const cv::Mat &R,
projector_
.
size
=
src
.
size
();
projector_
.
focal
=
focal
;
projector_
.
set
CameraMatrix
(
R
);
projector_
.
set
Transformation
(
R
);
cv
::
Point
dst_tl
,
dst_br
;
detectResultRoi
(
dst_tl
,
dst_br
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录