Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
88297115
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,发现更多精彩内容 >>
提交
88297115
编写于
3月 17, 2014
作者:
R
Roman Donchenko
提交者:
OpenCV Buildbot
3月 17, 2014
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2485 from Nerei:viz_correct_viewer_pose
上级
136e5eb8
24d8cbf9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
16 deletion
+12
-16
modules/viz/src/vizimpl.cpp
modules/viz/src/vizimpl.cpp
+3
-3
modules/viz/test/test_tutorial3.cpp
modules/viz/test/test_tutorial3.cpp
+9
-13
未找到文件。
modules/viz/src/vizimpl.cpp
浏览文件 @
88297115
...
...
@@ -427,12 +427,12 @@ void cv::viz::Viz3d::VizImpl::setViewerPose(const Affine3d &pose)
// Rotate the view vector
cv
::
Matx33d
rotation
=
pose
.
rotation
();
cv
::
Vec3d
y_axis
(
0.0
,
1.0
,
0.0
);
cv
::
Vec3d
y_axis
(
0.0
,
-
1.0
,
0.0
);
// In Computer Vision Camera Y-axis is oriented down
cv
::
Vec3d
up_vec
(
rotation
*
y_axis
);
// Compute the new focal point
cv
::
Vec3d
z_axis
(
0.0
,
0.0
,
1.0
);
cv
::
Vec3d
focal_vec
=
pos
_vec
+
rotation
*
z_axis
;
cv
::
Vec3d
focal_vec
=
pos
e
*
z_axis
;
camera
.
SetPosition
(
pos_vec
.
val
);
camera
.
SetFocalPoint
(
focal_vec
.
val
);
...
...
@@ -450,7 +450,7 @@ cv::Affine3d cv::viz::Viz3d::VizImpl::getViewerPose()
Vec3d
view_up
(
camera
.
GetViewUp
());
Vec3d
focal
(
camera
.
GetFocalPoint
());
Vec3d
y_axis
=
normalized
(
view_up
);
Vec3d
y_axis
=
normalized
(
-
view_up
);
// In Computer Vision Camera Y-axis is oriented down
Vec3d
z_axis
=
normalized
(
focal
-
pos
);
Vec3d
x_axis
=
normalized
(
y_axis
.
cross
(
z_axis
));
...
...
modules/viz/test/test_tutorial3.cpp
浏览文件 @
88297115
...
...
@@ -15,50 +15,46 @@ void tutorial3(bool camera_pov)
myWindow
.
showWidget
(
"Coordinate Widget"
,
viz
::
WCoordinateSystem
());
/// Let's assume camera has the following properties
Point3d
cam_
pos
(
3.0
,
3.0
,
3.0
),
cam_focal_point
(
3.0
,
3.0
,
2.0
),
cam_y_dir
(
-
1.0
,
0.0
,
0.0
);
Point3d
cam_
origin
(
3.0
,
3.0
,
3.0
),
cam_focal_point
(
3.0
,
3.0
,
2.0
),
cam_y_dir
(
-
1.0
,
0.0
,
0.0
);
/// We can get the pose of the cam using makeCameraPose
Affine3d
cam
_pose
=
viz
::
makeCameraPose
(
cam_pos
,
cam_focal_point
,
cam_y_dir
);
Affine3d
cam
era_pose
=
viz
::
makeCameraPose
(
cam_origin
,
cam_focal_point
,
cam_y_dir
);
/// We can get the transformation matrix from camera coordinate system to global using
/// - makeTransformToGlobal. We need the axes of the camera
Affine3d
transform
=
viz
::
makeTransformToGlobal
(
Vec3d
(
0.0
,
-
1.0
,
0.0
),
Vec3d
(
-
1.0
,
0.0
,
0.0
),
Vec3d
(
0.0
,
0.0
,
-
1.0
),
cam_
pos
);
Affine3d
transform
=
viz
::
makeTransformToGlobal
(
Vec3d
(
0.0
,
-
1.0
,
0.0
),
Vec3d
(
-
1.0
,
0.0
,
0.0
),
Vec3d
(
0.0
,
0.0
,
-
1.0
),
cam_
origin
);
/// Create a cloud widget.
Mat
dragon_cloud
=
viz
::
readCloud
(
get_dragon_ply_file_path
());
viz
::
WCloud
cloud_widget
(
dragon_cloud
,
viz
::
Color
::
green
());
/// Pose of the widget in camera frame
Affine3d
cloud_pose
=
Affine3d
().
translate
(
Vec3d
(
0.0
,
0.0
,
3.0
));
Affine3d
cloud_pose
=
Affine3d
().
rotate
(
Vec3d
(
0.0
,
CV_PI
/
2
,
0.0
)).
rotate
(
Vec3d
(
0.0
,
0.0
,
CV_PI
)).
translate
(
Vec3d
(
0.0
,
0.0
,
3.0
));
/// Pose of the widget in global frame
Affine3d
cloud_pose_global
=
transform
*
cloud_pose
;
/// Visualize camera frame
myWindow
.
showWidget
(
"CPW_FRUSTUM"
,
viz
::
WCameraPosition
(
Vec2f
(
0.889484
f
,
0.523599
f
)),
camera_pose
);
if
(
!
camera_pov
)
{
viz
::
WCameraPosition
cpw
(
0.5
);
// Coordinate axes
viz
::
WCameraPosition
cpw_frustum
(
Vec2f
(
0.889484
f
,
0.523599
f
));
// Camera frustum
myWindow
.
showWidget
(
"CPW"
,
cpw
,
cam_pose
);
myWindow
.
showWidget
(
"CPW_FRUSTUM"
,
cpw_frustum
,
cam_pose
);
}
myWindow
.
showWidget
(
"CPW"
,
viz
::
WCameraPosition
(
0.5
),
camera_pose
);
/// Visualize widget
myWindow
.
showWidget
(
"bunny"
,
cloud_widget
,
cloud_pose_global
);
/// Set the viewer pose to that of camera
if
(
camera_pov
)
myWindow
.
setViewerPose
(
cam_pose
);
myWindow
.
setViewerPose
(
cam
era
_pose
);
/// Start event loop.
myWindow
.
spin
();
}
TEST
(
Viz
,
DISABLED_
tutorial3_global_view
)
TEST
(
Viz
,
tutorial3_global_view
)
{
tutorial3
(
false
);
}
TEST
(
Viz
,
DISABLED_
tutorial3_camera_view
)
TEST
(
Viz
,
tutorial3_camera_view
)
{
tutorial3
(
true
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录