Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
36ef5998
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,发现更多精彩内容 >>
提交
36ef5998
编写于
4月 23, 2012
作者:
A
Alexey Spizhevoy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed trim ratio estimation for the case of homographies motion model (videostab)
上级
ae8d3775
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
18 deletion
+30
-18
modules/videostab/src/motion_stabilizing.cpp
modules/videostab/src/motion_stabilizing.cpp
+15
-3
samples/cpp/videostab.cpp
samples/cpp/videostab.cpp
+15
-15
未找到文件。
modules/videostab/src/motion_stabilizing.cpp
浏览文件 @
36ef5998
...
@@ -616,11 +616,15 @@ static inline bool isGoodMotion(const float M[], float w, float h, float dx, flo
...
@@ -616,11 +616,15 @@ static inline bool isGoodMotion(const float M[], float w, float h, float dx, flo
{
{
Point2f
pt
[
4
]
=
{
Point2f
(
0
,
0
),
Point2f
(
w
,
0
),
Point2f
(
w
,
h
),
Point2f
(
0
,
h
)};
Point2f
pt
[
4
]
=
{
Point2f
(
0
,
0
),
Point2f
(
w
,
0
),
Point2f
(
w
,
h
),
Point2f
(
0
,
h
)};
Point2f
Mpt
[
4
];
Point2f
Mpt
[
4
];
float
z
;
for
(
int
i
=
0
;
i
<
4
;
++
i
)
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
{
Mpt
[
i
].
x
=
M
[
0
]
*
pt
[
i
].
x
+
M
[
1
]
*
pt
[
i
].
y
+
M
[
2
];
Mpt
[
i
].
x
=
M
[
0
]
*
pt
[
i
].
x
+
M
[
1
]
*
pt
[
i
].
y
+
M
[
2
];
Mpt
[
i
].
y
=
M
[
3
]
*
pt
[
i
].
x
+
M
[
4
]
*
pt
[
i
].
y
+
M
[
5
];
Mpt
[
i
].
y
=
M
[
3
]
*
pt
[
i
].
x
+
M
[
4
]
*
pt
[
i
].
y
+
M
[
5
];
z
=
M
[
6
]
*
pt
[
i
].
x
+
M
[
7
]
*
pt
[
i
].
y
+
M
[
8
];
Mpt
[
i
].
x
/=
z
;
Mpt
[
i
].
y
/=
z
;
}
}
pt
[
0
]
=
Point2f
(
dx
,
dy
);
pt
[
0
]
=
Point2f
(
dx
,
dy
);
...
@@ -640,6 +644,9 @@ static inline void relaxMotion(const float M[], float t, float res[])
...
@@ -640,6 +644,9 @@ static inline void relaxMotion(const float M[], float t, float res[])
res
[
3
]
=
M
[
3
]
*
(
1.
f
-
t
);
res
[
3
]
=
M
[
3
]
*
(
1.
f
-
t
);
res
[
4
]
=
M
[
4
]
*
(
1.
f
-
t
)
+
t
;
res
[
4
]
=
M
[
4
]
*
(
1.
f
-
t
)
+
t
;
res
[
5
]
=
M
[
5
]
*
(
1.
f
-
t
);
res
[
5
]
=
M
[
5
]
*
(
1.
f
-
t
);
res
[
6
]
=
M
[
6
]
*
(
1.
f
-
t
);
res
[
7
]
=
M
[
7
]
*
(
1.
f
-
t
);
res
[
8
]
=
M
[
8
]
*
(
1.
f
-
t
)
+
t
;
}
}
...
@@ -651,11 +658,12 @@ Mat ensureInclusionConstraint(const Mat &M, Size size, float trimRatio)
...
@@ -651,11 +658,12 @@ Mat ensureInclusionConstraint(const Mat &M, Size size, float trimRatio)
const
float
h
=
static_cast
<
float
>
(
size
.
height
);
const
float
h
=
static_cast
<
float
>
(
size
.
height
);
const
float
dx
=
floor
(
w
*
trimRatio
);
const
float
dx
=
floor
(
w
*
trimRatio
);
const
float
dy
=
floor
(
h
*
trimRatio
);
const
float
dy
=
floor
(
h
*
trimRatio
);
const
float
srcM
[
6
]
=
const
float
srcM
[]
=
{
M
.
at
<
float
>
(
0
,
0
),
M
.
at
<
float
>
(
0
,
1
),
M
.
at
<
float
>
(
0
,
2
),
{
M
.
at
<
float
>
(
0
,
0
),
M
.
at
<
float
>
(
0
,
1
),
M
.
at
<
float
>
(
0
,
2
),
M
.
at
<
float
>
(
1
,
0
),
M
.
at
<
float
>
(
1
,
1
),
M
.
at
<
float
>
(
1
,
2
)};
M
.
at
<
float
>
(
1
,
0
),
M
.
at
<
float
>
(
1
,
1
),
M
.
at
<
float
>
(
1
,
2
),
M
.
at
<
float
>
(
2
,
0
),
M
.
at
<
float
>
(
2
,
1
),
M
.
at
<
float
>
(
2
,
2
)};
float
curM
[
6
];
float
curM
[
9
];
float
t
=
0
;
float
t
=
0
;
relaxMotion
(
srcM
,
t
,
curM
);
relaxMotion
(
srcM
,
t
,
curM
);
if
(
isGoodMotion
(
curM
,
w
,
h
,
dx
,
dy
))
if
(
isGoodMotion
(
curM
,
w
,
h
,
dx
,
dy
))
...
@@ -687,11 +695,15 @@ float estimateOptimalTrimRatio(const Mat &M, Size size)
...
@@ -687,11 +695,15 @@ float estimateOptimalTrimRatio(const Mat &M, Size size)
Point2f
pt
[
4
]
=
{
Point2f
(
0
,
0
),
Point2f
(
w
,
0
),
Point2f
(
w
,
h
),
Point2f
(
0
,
h
)};
Point2f
pt
[
4
]
=
{
Point2f
(
0
,
0
),
Point2f
(
w
,
0
),
Point2f
(
w
,
h
),
Point2f
(
0
,
h
)};
Point2f
Mpt
[
4
];
Point2f
Mpt
[
4
];
float
z
;
for
(
int
i
=
0
;
i
<
4
;
++
i
)
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
{
Mpt
[
i
].
x
=
M_
(
0
,
0
)
*
pt
[
i
].
x
+
M_
(
0
,
1
)
*
pt
[
i
].
y
+
M_
(
0
,
2
);
Mpt
[
i
].
x
=
M_
(
0
,
0
)
*
pt
[
i
].
x
+
M_
(
0
,
1
)
*
pt
[
i
].
y
+
M_
(
0
,
2
);
Mpt
[
i
].
y
=
M_
(
1
,
0
)
*
pt
[
i
].
x
+
M_
(
1
,
1
)
*
pt
[
i
].
y
+
M_
(
1
,
2
);
Mpt
[
i
].
y
=
M_
(
1
,
0
)
*
pt
[
i
].
x
+
M_
(
1
,
1
)
*
pt
[
i
].
y
+
M_
(
1
,
2
);
z
=
M_
(
2
,
0
)
*
pt
[
i
].
x
+
M_
(
2
,
1
)
*
pt
[
i
].
y
+
M_
(
2
,
2
);
Mpt
[
i
].
x
/=
z
;
Mpt
[
i
].
y
/=
z
;
}
}
float
l
=
0
,
r
=
0.5
f
;
float
l
=
0
,
r
=
0.5
f
;
...
...
samples/cpp/videostab.cpp
浏览文件 @
36ef5998
...
@@ -95,15 +95,15 @@ void printHelp()
...
@@ -95,15 +95,15 @@ void printHelp()
" (i.e. sqrt(radius)).
\n
"
" (i.e. sqrt(radius)).
\n
"
" -lps, --lin-prog-stab=(yes|no)
\n
"
" -lps, --lin-prog-stab=(yes|no)
\n
"
" Turn on/off linear programming based stabilization method.
\n
"
" Turn on/off linear programming based stabilization method.
\n
"
" --lp-trim-ratio=(<float_number>|auto)
\n
"
" --lp
s
-trim-ratio=(<float_number>|auto)
\n
"
" Trimming ratio used in linear programming based method.
\n
"
" Trimming ratio used in linear programming based method.
\n
"
" --lp-w1=(<float_number>|1)
\n
"
" --lp
s
-w1=(<float_number>|1)
\n
"
" 1st derivative weight. The default is 1.
\n
"
" 1st derivative weight. The default is 1.
\n
"
" --lp-w2=(<float_number>|10)
\n
"
" --lp
s
-w2=(<float_number>|10)
\n
"
" 2nd derivative weight. The default is 10.
\n
"
" 2nd derivative weight. The default is 10.
\n
"
" --lp-w3=(<float_number>|100)
\n
"
" --lp
s
-w3=(<float_number>|100)
\n
"
" 3rd derivative weight. The default is 100.
\n
"
" 3rd derivative weight. The default is 100.
\n
"
" --lp-w4=(<float_number>|100)
\n
"
" --lp
s
-w4=(<float_number>|100)
\n
"
" Non-translation motion components weight. The default is 100.
\n\n
"
" Non-translation motion components weight. The default is 100.
\n\n
"
" --deblur=(yes|no)
\n
"
" --deblur=(yes|no)
\n
"
" Do deblurring.
\n
"
" Do deblurring.
\n
"
...
@@ -185,11 +185,11 @@ int main(int argc, const char **argv)
...
@@ -185,11 +185,11 @@ int main(int argc, const char **argv)
"{ r | radius | 15 | }"
"{ r | radius | 15 | }"
"{ | stdev | auto | }"
"{ | stdev | auto | }"
"{ lps | lin-prog-stab | no | }"
"{ lps | lin-prog-stab | no | }"
"{ | lp-trim-ratio | auto | }"
"{ | lp
s
-trim-ratio | auto | }"
"{ | lp-w1 | 1 | }"
"{ | lp
s
-w1 | 1 | }"
"{ | lp-w2 | 10 | }"
"{ | lp
s
-w2 | 10 | }"
"{ | lp-w3 | 100 | }"
"{ | lp
s
-w3 | 100 | }"
"{ | lp-w4 | 100 | }"
"{ | lp
s
-w4 | 100 | }"
"{ | deblur | no | }"
"{ | deblur | no | }"
"{ | deblur-sens | 0.1 | }"
"{ | deblur-sens | 0.1 | }"
"{ et | est-trim | yes | }"
"{ et | est-trim | yes | }"
...
@@ -260,11 +260,11 @@ int main(int argc, const char **argv)
...
@@ -260,11 +260,11 @@ int main(int argc, const char **argv)
{
{
LpMotionStabilizer
*
stab
=
new
LpMotionStabilizer
();
LpMotionStabilizer
*
stab
=
new
LpMotionStabilizer
();
stab
->
setFrameSize
(
Size
(
source
->
width
(),
source
->
height
()));
stab
->
setFrameSize
(
Size
(
source
->
width
(),
source
->
height
()));
stab
->
setTrimRatio
(
arg
(
"lp
-trim-ratio"
)
==
"auto"
?
argf
(
"trim-ratio"
)
:
argf
(
"lp
-trim-ratio"
));
stab
->
setTrimRatio
(
arg
(
"lp
s-trim-ratio"
)
==
"auto"
?
argf
(
"trim-ratio"
)
:
argf
(
"lps
-trim-ratio"
));
stab
->
setWeight1
(
argf
(
"lp-w1"
));
stab
->
setWeight1
(
argf
(
"lp
s
-w1"
));
stab
->
setWeight2
(
argf
(
"lp-w2"
));
stab
->
setWeight2
(
argf
(
"lp
s
-w2"
));
stab
->
setWeight3
(
argf
(
"lp-w3"
));
stab
->
setWeight3
(
argf
(
"lp
s
-w3"
));
stab
->
setWeight4
(
argf
(
"lp-w4"
));
stab
->
setWeight4
(
argf
(
"lp
s
-w4"
));
twoPassStabilizer
->
setMotionStabilizer
(
stab
);
twoPassStabilizer
->
setMotionStabilizer
(
stab
);
}
}
else
if
(
arg
(
"stdev"
)
==
"auto"
)
else
if
(
arg
(
"stdev"
)
==
"auto"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录