Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
8fa6b6a6
Commit
8fa6b6a6
authored
Aug 01, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial setViewerPose implementation
parent
54774f6d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
0 deletions
+29
-0
viz3d.hpp
modules/viz/include/opencv2/viz/viz3d.hpp
+3
-0
viz3d.cpp
modules/viz/src/viz3d.cpp
+3
-0
viz3d_impl.cpp
modules/viz/src/viz3d_impl.cpp
+22
-0
viz3d_impl.hpp
modules/viz/src/viz3d_impl.hpp
+1
-0
No files found.
modules/viz/include/opencv2/viz/viz3d.hpp
View file @
8fa6b6a6
...
...
@@ -39,6 +39,9 @@ namespace cv
void
updateWidgetPose
(
const
String
&
id
,
const
Affine3f
&
pose
);
Affine3f
getWidgetPose
(
const
String
&
id
)
const
;
Affine3f
getViewerPose
();
void
setViewerPose
(
const
Affine3f
&
pose
);
void
spin
();
void
spinOnce
(
int
time
=
1
,
bool
force_redraw
=
false
);
bool
wasStopped
()
const
;
...
...
modules/viz/src/viz3d.cpp
View file @
8fa6b6a6
...
...
@@ -45,3 +45,6 @@ cv::viz::Widget cv::viz::Viz3d::getWidget(const String &id) const { return impl_
void
cv
::
viz
::
Viz3d
::
setWidgetPose
(
const
String
&
id
,
const
Affine3f
&
pose
)
{
impl_
->
setWidgetPose
(
id
,
pose
);
}
void
cv
::
viz
::
Viz3d
::
updateWidgetPose
(
const
String
&
id
,
const
Affine3f
&
pose
)
{
impl_
->
updateWidgetPose
(
id
,
pose
);
}
cv
::
Affine3f
cv
::
viz
::
Viz3d
::
getWidgetPose
(
const
String
&
id
)
const
{
return
impl_
->
getWidgetPose
(
id
);
}
void
cv
::
viz
::
Viz3d
::
setViewerPose
(
const
Affine3f
&
pose
)
{
impl_
->
setViewerPose
(
pose
);
}
cv
::
Affine3f
cv
::
viz
::
Viz3d
::
getViewerPose
()
{
return
impl_
->
getViewerPose
();
}
modules/viz/src/viz3d_impl.cpp
View file @
8fa6b6a6
...
...
@@ -591,6 +591,28 @@ void cv::viz::Viz3d::VizImpl::getCameras (cv::viz::Camera& camera)
camera
.
window_pos
=
cv
::
Vec2d
::
all
(
0
);
}
/////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setViewerPose
(
const
Affine3f
&
pose
)
{
vtkCamera
&
camera
=
*
renderer_
->
GetActiveCamera
();
// Position = extrinsic translation
cv
::
Vec3f
pos_vec
=
pose
.
translation
();
// Rotate the view vector
cv
::
Matx33f
rotation
=
pose
.
rotation
();
cv
::
Vec3f
y_axis
(
0.
f
,
1.
f
,
0.
f
);
cv
::
Vec3f
up_vec
(
rotation
*
y_axis
);
// Compute the new focal point
cv
::
Vec3f
z_axis
(
0.
f
,
0.
f
,
1.
f
);
cv
::
Vec3f
focal_vec
=
pos_vec
+
rotation
*
z_axis
;
camera
.
SetPosition
(
pos_vec
[
0
],
pos_vec
[
1
],
pos_vec
[
2
]);
camera
.
SetFocalPoint
(
focal_vec
[
0
],
focal_vec
[
1
],
focal_vec
[
2
]);
camera
.
SetViewUp
(
up_vec
[
0
],
up_vec
[
1
],
up_vec
[
2
]);
}
/////////////////////////////////////////////////////////////////////////////////////////////
cv
::
Affine3f
cv
::
viz
::
Viz3d
::
VizImpl
::
getViewerPose
()
{
...
...
modules/viz/src/viz3d_impl.hpp
View file @
8fa6b6a6
...
...
@@ -140,6 +140,7 @@ public:
void
getCameras
(
Camera
&
camera
);
//to implement Viz3d set/getViewerPose()
void
setViewerPose
(
const
Affine3f
&
pose
);
Affine3f
getViewerPose
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment