Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
a8ba2d7f
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,发现更多精彩内容 >>
提交
a8ba2d7f
编写于
9月 21, 2012
作者:
I
Ivan Korolev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added Rotation motion mode in the videostab module
上级
3b075a50
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
6 deletion
+53
-6
modules/videostab/include/opencv2/videostab/motion_core.hpp
modules/videostab/include/opencv2/videostab/motion_core.hpp
+8
-5
modules/videostab/src/global_motion.cpp
modules/videostab/src/global_motion.cpp
+45
-1
未找到文件。
modules/videostab/include/opencv2/videostab/motion_core.hpp
浏览文件 @
a8ba2d7f
...
...
@@ -55,11 +55,12 @@ enum MotionModel
{
MM_TRANSLATION
=
0
,
MM_TRANSLATION_AND_SCALE
=
1
,
MM_RIGID
=
2
,
MM_SIMILARITY
=
3
,
MM_AFFINE
=
4
,
MM_HOMOGRAPHY
=
5
,
MM_UNKNOWN
=
6
MM_ROTATION
=
2
,
MM_RIGID
=
3
,
MM_SIMILARITY
=
4
,
MM_AFFINE
=
5
,
MM_HOMOGRAPHY
=
6
,
MM_UNKNOWN
=
7
};
struct
CV_EXPORTS
RansacParams
...
...
@@ -85,6 +86,8 @@ struct CV_EXPORTS RansacParams
return
RansacParams
(
1
,
0.5
f
,
0.5
f
,
0.99
f
);
if
(
model
==
MM_TRANSLATION_AND_SCALE
)
return
RansacParams
(
2
,
0.5
f
,
0.5
f
,
0.99
f
);
if
(
model
==
MM_ROTATION
)
return
RansacParams
(
1
,
0.5
f
,
0.5
f
,
0.99
f
);
if
(
model
==
MM_RIGID
)
return
RansacParams
(
2
,
0.5
f
,
0.5
f
,
0.99
f
);
if
(
model
==
MM_SIMILARITY
)
...
...
modules/videostab/src/global_motion.cpp
浏览文件 @
a8ba2d7f
...
...
@@ -151,8 +151,51 @@ static Mat estimateGlobMotionLeastSquaresTranslationAndScale(
return
T1
.
inv
()
*
M
*
T0
;
}
static
Mat
estimateGlobMotionLeastSquaresRotation
(
int
npoints
,
Point2f
*
points0
,
Point2f
*
points1
,
float
*
rmse
)
{
Point2f
p0
,
p1
;
float
A
(
0
),
B
(
0
);
for
(
int
i
=
0
;
i
<
npoints
;
++
i
)
{
p0
=
points0
[
i
];
p1
=
points1
[
i
];
A
+=
p0
.
x
*
p1
.
x
+
p0
.
y
*
p1
.
y
;
B
+=
p0
.
x
*
p1
.
y
-
p1
.
x
*
p0
.
y
;
}
// A*sin(alpha) + B*cos(alpha) = 0
float
C
=
sqrt
(
A
*
A
+
B
*
B
);
Mat_
<
float
>
M
=
Mat
::
eye
(
3
,
3
,
CV_32F
);
if
(
C
!=
0
)
{
float
sinAlpha
=
-
B
/
C
;
float
cosAlpha
=
A
/
C
;
M
(
0
,
0
)
=
cosAlpha
;
M
(
1
,
1
)
=
M
(
0
,
0
);
M
(
0
,
1
)
=
sinAlpha
;
M
(
1
,
0
)
=
-
M
(
0
,
1
);
}
if
(
rmse
)
{
*
rmse
=
0
;
for
(
int
i
=
0
;
i
<
npoints
;
++
i
)
{
p0
=
points0
[
i
];
p1
=
points1
[
i
];
*
rmse
+=
sqr
(
p1
.
x
-
M
(
0
,
0
)
*
p0
.
x
-
M
(
0
,
1
)
*
p0
.
y
)
+
sqr
(
p1
.
y
-
M
(
1
,
0
)
*
p0
.
x
-
M
(
1
,
1
)
*
p0
.
y
);
}
*
rmse
=
sqrt
(
*
rmse
/
npoints
);
}
return
M
;
}
static
Mat
estimateGlobMotionLeastSquaresRigid
(
static
Mat
estimateGlobMotionLeastSquaresRigid
(
int
npoints
,
Point2f
*
points0
,
Point2f
*
points1
,
float
*
rmse
)
{
Point2f
mean0
(
0.
f
,
0.
f
);
...
...
@@ -294,6 +337,7 @@ Mat estimateGlobalMotionLeastSquares(
typedef
Mat
(
*
Impl
)(
int
,
Point2f
*
,
Point2f
*
,
float
*
);
static
Impl
impls
[]
=
{
estimateGlobMotionLeastSquaresTranslation
,
estimateGlobMotionLeastSquaresTranslationAndScale
,
estimateGlobMotionLeastSquaresRotation
,
estimateGlobMotionLeastSquaresRigid
,
estimateGlobMotionLeastSquaresSimilarity
,
estimateGlobMotionLeastSquaresAffine
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录