Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
710506e9
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,发现更多精彩内容 >>
提交
710506e9
编写于
2月 27, 2017
作者:
V
Vladislav Sovrasov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
calib3d: add a new overload for recoverPose
上级
dcbed8d6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
11 deletion
+53
-11
modules/calib3d/include/opencv2/calib3d.hpp
modules/calib3d/include/opencv2/calib3d.hpp
+22
-0
modules/calib3d/src/five-point.cpp
modules/calib3d/src/five-point.cpp
+31
-11
未找到文件。
modules/calib3d/include/opencv2/calib3d.hpp
浏览文件 @
710506e9
...
...
@@ -1433,6 +1433,28 @@ CV_EXPORTS_W int recoverPose( InputArray E, InputArray points1, InputArray point
double
focal
=
1.0
,
Point2d
pp
=
Point2d
(
0
,
0
),
InputOutputArray
mask
=
noArray
()
);
/** @overload
@param E The input essential matrix.
@param points1 Array of N 2D points from the first image. The point coordinates should be
floating-point (single or double precision).
@param points2 Array of the second image points of the same size and format as points1.
@param cameraMatrix Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ .
Note that this function assumes that points1 and points2 are feature points from cameras with the
same camera matrix.
@param R Recovered relative rotation.
@param t Recoverd relative translation.
@param distanceThresh threshold distance which is used to filter out far away points (i.e. infinite points).
@param mask Input/output mask for inliers in points1 and points2.
: If it is not empty, then it marks inliers in points1 and points2 for then given essential
matrix E. Only these inliers will be used to recover pose. In the output mask only inliers
which pass the cheirality check.
@param triangulatedPoints 3d points which were reconstructed by triangulation.
*/
CV_EXPORTS_W
int
recoverPose
(
InputArray
E
,
InputArray
points1
,
InputArray
points2
,
InputArray
cameraMatrix
,
OutputArray
R
,
OutputArray
t
,
double
distanceThresh
,
InputOutputArray
mask
=
noArray
(),
OutputArray
triangulatedPoints
=
noArray
());
/** @brief For points in an image of a stereo pair, computes the corresponding epilines in the other image.
@param points Input points. \f$N \times 1\f$ or \f$1 \times N\f$ matrix of type CV_32FC2 or
...
...
modules/calib3d/src/five-point.cpp
浏览文件 @
710506e9
...
...
@@ -458,8 +458,9 @@ cv::Mat cv::findEssentialMat( InputArray _points1, InputArray _points2, double f
return
cv
::
findEssentialMat
(
_points1
,
_points2
,
cameraMatrix
,
method
,
prob
,
threshold
,
_mask
);
}
int
cv
::
recoverPose
(
InputArray
E
,
InputArray
_points1
,
InputArray
_points2
,
InputArray
_cameraMatrix
,
OutputArray
_R
,
OutputArray
_t
,
InputOutputArray
_mask
)
int
cv
::
recoverPose
(
InputArray
E
,
InputArray
_points1
,
InputArray
_points2
,
InputArray
_cameraMatrix
,
OutputArray
_R
,
OutputArray
_t
,
double
distanceThresh
,
InputOutputArray
_mask
,
OutputArray
triangulatedPoints
)
{
CV_INSTRUMENT_REGION
()
...
...
@@ -506,51 +507,60 @@ int cv::recoverPose( InputArray E, InputArray _points1, InputArray _points2, Inp
// Notice here a threshold dist is used to filter
// out far away points (i.e. infinite points) since
// there depth may vary between postive and negtive.
double
dist
=
50.0
;
std
::
vector
<
Mat
>
allTriangulations
(
4
)
;
Mat
Q
;
triangulatePoints
(
P0
,
P1
,
points1
,
points2
,
Q
);
if
(
triangulatedPoints
.
needed
())
Q
.
copyTo
(
allTriangulations
[
0
]);
Mat
mask1
=
Q
.
row
(
2
).
mul
(
Q
.
row
(
3
))
>
0
;
Q
.
row
(
0
)
/=
Q
.
row
(
3
);
Q
.
row
(
1
)
/=
Q
.
row
(
3
);
Q
.
row
(
2
)
/=
Q
.
row
(
3
);
Q
.
row
(
3
)
/=
Q
.
row
(
3
);
mask1
=
(
Q
.
row
(
2
)
<
dist
)
&
mask1
;
mask1
=
(
Q
.
row
(
2
)
<
dist
anceThresh
)
&
mask1
;
Q
=
P1
*
Q
;
mask1
=
(
Q
.
row
(
2
)
>
0
)
&
mask1
;
mask1
=
(
Q
.
row
(
2
)
<
dist
)
&
mask1
;
mask1
=
(
Q
.
row
(
2
)
<
dist
anceThresh
)
&
mask1
;
triangulatePoints
(
P0
,
P2
,
points1
,
points2
,
Q
);
if
(
triangulatedPoints
.
needed
())
Q
.
copyTo
(
allTriangulations
[
1
]);
Mat
mask2
=
Q
.
row
(
2
).
mul
(
Q
.
row
(
3
))
>
0
;
Q
.
row
(
0
)
/=
Q
.
row
(
3
);
Q
.
row
(
1
)
/=
Q
.
row
(
3
);
Q
.
row
(
2
)
/=
Q
.
row
(
3
);
Q
.
row
(
3
)
/=
Q
.
row
(
3
);
mask2
=
(
Q
.
row
(
2
)
<
dist
)
&
mask2
;
mask2
=
(
Q
.
row
(
2
)
<
dist
anceThresh
)
&
mask2
;
Q
=
P2
*
Q
;
mask2
=
(
Q
.
row
(
2
)
>
0
)
&
mask2
;
mask2
=
(
Q
.
row
(
2
)
<
dist
)
&
mask2
;
mask2
=
(
Q
.
row
(
2
)
<
dist
anceThresh
)
&
mask2
;
triangulatePoints
(
P0
,
P3
,
points1
,
points2
,
Q
);
if
(
triangulatedPoints
.
needed
())
Q
.
copyTo
(
allTriangulations
[
2
]);
Mat
mask3
=
Q
.
row
(
2
).
mul
(
Q
.
row
(
3
))
>
0
;
Q
.
row
(
0
)
/=
Q
.
row
(
3
);
Q
.
row
(
1
)
/=
Q
.
row
(
3
);
Q
.
row
(
2
)
/=
Q
.
row
(
3
);
Q
.
row
(
3
)
/=
Q
.
row
(
3
);
mask3
=
(
Q
.
row
(
2
)
<
dist
)
&
mask3
;
mask3
=
(
Q
.
row
(
2
)
<
dist
anceThresh
)
&
mask3
;
Q
=
P3
*
Q
;
mask3
=
(
Q
.
row
(
2
)
>
0
)
&
mask3
;
mask3
=
(
Q
.
row
(
2
)
<
dist
)
&
mask3
;
mask3
=
(
Q
.
row
(
2
)
<
dist
anceThresh
)
&
mask3
;
triangulatePoints
(
P0
,
P4
,
points1
,
points2
,
Q
);
if
(
triangulatedPoints
.
needed
())
Q
.
copyTo
(
allTriangulations
[
3
]);
Mat
mask4
=
Q
.
row
(
2
).
mul
(
Q
.
row
(
3
))
>
0
;
Q
.
row
(
0
)
/=
Q
.
row
(
3
);
Q
.
row
(
1
)
/=
Q
.
row
(
3
);
Q
.
row
(
2
)
/=
Q
.
row
(
3
);
Q
.
row
(
3
)
/=
Q
.
row
(
3
);
mask4
=
(
Q
.
row
(
2
)
<
dist
)
&
mask4
;
mask4
=
(
Q
.
row
(
2
)
<
dist
anceThresh
)
&
mask4
;
Q
=
P4
*
Q
;
mask4
=
(
Q
.
row
(
2
)
>
0
)
&
mask4
;
mask4
=
(
Q
.
row
(
2
)
<
dist
)
&
mask4
;
mask4
=
(
Q
.
row
(
2
)
<
dist
anceThresh
)
&
mask4
;
mask1
=
mask1
.
t
();
mask2
=
mask2
.
t
();
...
...
@@ -583,6 +593,7 @@ int cv::recoverPose( InputArray E, InputArray _points1, InputArray _points2, Inp
if
(
good1
>=
good2
&&
good1
>=
good3
&&
good1
>=
good4
)
{
if
(
triangulatedPoints
.
needed
())
allTriangulations
[
0
].
copyTo
(
triangulatedPoints
);
R1
.
copyTo
(
_R
);
t
.
copyTo
(
_t
);
if
(
_mask
.
needed
())
mask1
.
copyTo
(
_mask
);
...
...
@@ -590,6 +601,7 @@ int cv::recoverPose( InputArray E, InputArray _points1, InputArray _points2, Inp
}
else
if
(
good2
>=
good1
&&
good2
>=
good3
&&
good2
>=
good4
)
{
if
(
triangulatedPoints
.
needed
())
allTriangulations
[
1
].
copyTo
(
triangulatedPoints
);
R2
.
copyTo
(
_R
);
t
.
copyTo
(
_t
);
if
(
_mask
.
needed
())
mask2
.
copyTo
(
_mask
);
...
...
@@ -597,6 +609,7 @@ int cv::recoverPose( InputArray E, InputArray _points1, InputArray _points2, Inp
}
else
if
(
good3
>=
good1
&&
good3
>=
good2
&&
good3
>=
good4
)
{
if
(
triangulatedPoints
.
needed
())
allTriangulations
[
2
].
copyTo
(
triangulatedPoints
);
t
=
-
t
;
R1
.
copyTo
(
_R
);
t
.
copyTo
(
_t
);
...
...
@@ -605,6 +618,7 @@ int cv::recoverPose( InputArray E, InputArray _points1, InputArray _points2, Inp
}
else
{
if
(
triangulatedPoints
.
needed
())
allTriangulations
[
3
].
copyTo
(
triangulatedPoints
);
t
=
-
t
;
R2
.
copyTo
(
_R
);
t
.
copyTo
(
_t
);
...
...
@@ -613,6 +627,12 @@ int cv::recoverPose( InputArray E, InputArray _points1, InputArray _points2, Inp
}
}
int
cv
::
recoverPose
(
InputArray
E
,
InputArray
_points1
,
InputArray
_points2
,
InputArray
_cameraMatrix
,
OutputArray
_R
,
OutputArray
_t
,
InputOutputArray
_mask
)
{
return
cv
::
recoverPose
(
E
,
_points1
,
_points2
,
_cameraMatrix
,
_R
,
_t
,
50
,
_mask
);
}
int
cv
::
recoverPose
(
InputArray
E
,
InputArray
_points1
,
InputArray
_points2
,
OutputArray
_R
,
OutputArray
_t
,
double
focal
,
Point2d
pp
,
InputOutputArray
_mask
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录