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
9c20e770
Commit
9c20e770
authored
Aug 05, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix conversion functions to use appropriate vtk function
parent
f8ad3c02
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
28 deletions
+20
-28
viz3d.hpp
modules/viz/include/opencv2/viz/viz3d.hpp
+2
-2
viz3d.cpp
modules/viz/src/viz3d.cpp
+3
-3
viz3d_impl.cpp
modules/viz/src/viz3d_impl.cpp
+13
-21
viz3d_impl.hpp
modules/viz/src/viz3d_impl.hpp
+2
-2
No files found.
modules/viz/include/opencv2/viz/viz3d.hpp
View file @
9c20e770
...
...
@@ -44,8 +44,8 @@ namespace cv
Affine3f
getViewerPose
();
void
setViewerPose
(
const
Affine3f
&
pose
);
void
convertToWindowCoordinates
(
const
Point3
f
&
pt
,
Point3f
&
window_coord
);
void
converTo3DRay
(
const
Point3
f
&
window_coord
,
Point3f
&
origin
,
Vec3f
&
direction
);
void
convertToWindowCoordinates
(
const
Point3
d
&
pt
,
Point3d
&
window_coord
);
void
converTo3DRay
(
const
Point3
d
&
window_coord
,
Point3d
&
origin
,
Vec3d
&
direction
);
void
spin
();
void
spinOnce
(
int
time
=
1
,
bool
force_redraw
=
false
);
...
...
modules/viz/src/viz3d.cpp
View file @
9c20e770
...
...
@@ -51,5 +51,5 @@ cv::viz::Camera cv::viz::Viz3d::getCamera() const { return impl_->getCamera(); }
void
cv
::
viz
::
Viz3d
::
setViewerPose
(
const
Affine3f
&
pose
)
{
impl_
->
setViewerPose
(
pose
);
}
cv
::
Affine3f
cv
::
viz
::
Viz3d
::
getViewerPose
()
{
return
impl_
->
getViewerPose
();
}
void
cv
::
viz
::
Viz3d
::
convertToWindowCoordinates
(
const
Point3f
&
pt
,
Point3f
&
window_coord
)
{
impl_
->
convertToWindowCoordinates
(
pt
,
window_coord
);
}
void
cv
::
viz
::
Viz3d
::
converTo3DRay
(
const
Point3f
&
window_coord
,
Point3f
&
origin
,
Vec3f
&
direction
)
{
impl_
->
converTo3DRay
(
window_coord
,
origin
,
direction
);
}
\ No newline at end of file
void
cv
::
viz
::
Viz3d
::
convertToWindowCoordinates
(
const
Point3d
&
pt
,
Point3d
&
window_coord
)
{
impl_
->
convertToWindowCoordinates
(
pt
,
window_coord
);
}
void
cv
::
viz
::
Viz3d
::
converTo3DRay
(
const
Point3d
&
window_coord
,
Point3d
&
origin
,
Vec3d
&
direction
)
{
impl_
->
converTo3DRay
(
window_coord
,
origin
,
direction
);
}
\ No newline at end of file
modules/viz/src/viz3d_impl.cpp
View file @
9c20e770
...
...
@@ -642,32 +642,24 @@ cv::Affine3f cv::viz::Viz3d::VizImpl::getViewerPose ()
}
/////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
convertToWindowCoordinates
(
const
Point3
f
&
pt
,
Point3f
&
window_coord
)
void
cv
::
viz
::
Viz3d
::
VizImpl
::
convertToWindowCoordinates
(
const
Point3
d
&
pt
,
Point3d
&
window_coord
)
{
// Use the built in function of renderer
double
point_wcs
[
3
]
=
{
pt
.
x
,
pt
.
y
,
pt
.
z
};
renderer_
->
WorldToView
(
point_wcs
[
0
],
point_wcs
[
1
],
point_wcs
[
2
]);
window_coord
.
x
=
point_wcs
[
0
];
window_coord
.
y
=
point_wcs
[
1
];
window_coord
.
z
=
point_wcs
[
2
];
Vec3d
window_pt
;
vtkInteractorObserver
::
ComputeWorldToDisplay
(
renderer_
,
pt
.
x
,
pt
.
y
,
pt
.
z
,
window_pt
.
val
);
window_coord
=
window_pt
;
}
/////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
converTo3DRay
(
const
Point3f
&
window_coord
,
Point3f
&
origin
,
Vec3f
&
direction
)
{
// Use the built in function of renderer
double
point_view
[
3
]
=
{
window_coord
.
x
,
window_coord
.
y
,
window_coord
.
z
};
renderer_
->
ViewToWorld
(
point_view
[
0
],
point_view
[
1
],
point_view
[
2
]);
void
cv
::
viz
::
Viz3d
::
VizImpl
::
converTo3DRay
(
const
Point3d
&
window_coord
,
Point3d
&
origin
,
Vec3d
&
direction
)
{
Vec4d
world_pt
;
vtkInteractorObserver
::
ComputeDisplayToWorld
(
renderer_
,
window_coord
.
x
,
window_coord
.
y
,
window_coord
.
z
,
world_pt
.
val
);
vtkCamera
&
active_camera
=
*
renderer_
->
GetActiveCamera
();
double
*
cam_pos
=
active_camera
.
GetPosition
();
origin
.
x
=
cam_pos
[
0
];
origin
.
y
=
cam_pos
[
1
];
origin
.
z
=
cam_pos
[
2
];
direction
[
0
]
=
point_view
[
0
]
-
cam_pos
[
0
];
direction
[
1
]
=
point_view
[
1
]
-
cam_pos
[
1
];
direction
[
2
]
=
point_view
[
2
]
-
cam_pos
[
2
];
normalize
(
direction
);
Vec3d
cam_pos
;
active_camera
.
GetPosition
(
cam_pos
.
val
);
origin
=
cam_pos
;
direction
=
normalize
(
Vec3d
(
world_pt
.
val
)
-
cam_pos
);
}
/////////////////////////////////////////////////////////////////////////////////////////////
...
...
modules/viz/src/viz3d_impl.hpp
View file @
9c20e770
...
...
@@ -126,8 +126,8 @@ public:
void
setViewerPose
(
const
Affine3f
&
pose
);
Affine3f
getViewerPose
();
void
convertToWindowCoordinates
(
const
Point3
f
&
pt
,
Point3f
&
window_coord
);
void
converTo3DRay
(
const
Point3
f
&
window_coord
,
Point3f
&
origin
,
Vec3f
&
direction
);
void
convertToWindowCoordinates
(
const
Point3
d
&
pt
,
Point3d
&
window_coord
);
void
converTo3DRay
(
const
Point3
d
&
window_coord
,
Point3d
&
origin
,
Vec3d
&
direction
);
...
...
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