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
6ca1822f
Commit
6ca1822f
authored
Jul 13, 2013
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added comments with future work for VizImpl
added authors to license header
parent
d6e2b657
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
56 deletions
+54
-56
CMakeLists.txt
modules/viz/CMakeLists.txt
+20
-15
viz.hpp
modules/viz/include/opencv2/viz.hpp
+8
-4
types.hpp
modules/viz/include/opencv2/viz/types.hpp
+0
-1
viz.cpp
modules/viz/src/viz.cpp
+19
-0
viz3d_impl.cpp
modules/viz/src/viz3d_impl.cpp
+7
-36
viz3d_impl.hpp
modules/viz/src/viz3d_impl.hpp
+0
-0
No files found.
modules/viz/CMakeLists.txt
View file @
6ca1822f
set
(
BUILD_opencv_viz_INIT OFF
)
###############################################################################
# Find qvtk
# This sets the following variables:
...
...
@@ -36,18 +39,21 @@ macro(find_vtk)
endif
()
endmacro
()
find_vtk
()
find_package
(
OpenGL
)
if
(
OPENGL_FOUND
)
if
(
OPENGL_INCLUDE_DIR
)
include_directories
(
"
${
OPENGL_INCLUDE_DIR
}
"
)
endif
()
if
(
OPENGL_DEFINITIONS
)
add_definitions
(
"
${
OPENGL_DEFINITIONS
}
"
)
endif
()
endif
()
#find_package(OpenGL)
#if (OPENGL_FOUND)
# if(OPENGL_INCLUDE_DIR)
# include_directories("${OPENGL_INCLUDE_DIR}")
# endif()
# if(OPENGL_DEFINITIONS)
# add_definitions("${OPENGL_DEFINITIONS}")
# endif()
#endif()
find_vtk
()
if
(
NOT HAVE_VTK
)
...
...
@@ -65,14 +71,13 @@ endif()
add_definitions
(
-DHAVE_VTK
)
set
(
the_description
"Viz"
)
set
(
BUILD_opencv_viz_INIT OFF
)
include_directories
(
src
)
set
(
the_description
"Viz"
)
ocv_define_module
(
viz opencv_core opencv_calib3d
)
#${PCL_LIBRARIES}
ocv_define_module
(
viz opencv_core
)
target_link_libraries
(
opencv_viz vtkCommon vtkWidgets vtkHybrid vtkCharts vtkFiltering vtkRendering
${
OPENGL_LIBRARIES
}
)
target_link_libraries
(
opencv_viz vtkCommon vtkWidgets vtkFiltering vtkRendering
)
#${OPENGL_LIBRARIES})
if
(
APPLE
)
target_link_libraries
(
opencv_viz
"-framework Cocoa"
)
...
...
modules/viz/include/opencv2/viz.hpp
View file @
6ca1822f
...
...
@@ -38,9 +38,12 @@
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// * Point Cloud Library (PCL) - www.pointclouds.org
// During implementation if OpenCV Viz module, similar module
// from PCL was used as reference implementation.
// Authors:
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
// * Ozan Tonkal
//
// During implementation of OpenCV Viz module, similar module
// from PCL (www.pointclouds.org) was used as reference implementation.
//
//M*/
...
...
@@ -60,9 +63,10 @@ namespace cv
//! takes coordiante frame data and builds transfrom to global coordinate frame
CV_EXPORTS
Affine3f
makeTransformToGlobal
(
const
Vec3f
&
axis_x
,
const
Vec3f
&
axis_y
,
const
Vec3f
&
axis_z
,
const
Vec3f
&
origin
=
Vec3f
::
all
(
0
));
//! constructs camera pose from posi
ont
, focal_point and up_vector (see gluLookAt() for more infromation
//! constructs camera pose from posi
tion
, focal_point and up_vector (see gluLookAt() for more infromation
CV_EXPORTS
Affine3f
makeCameraPose
(
const
Vec3f
&
position
,
const
Vec3f
&
focal_point
,
const
Vec3f
&
up_vector
);
//! checks float value for Nan
inline
bool
isNan
(
float
x
)
{
...
...
modules/viz/include/opencv2/viz/types.hpp
View file @
6ca1822f
#pragma once
#include <string>
#include <opencv2/core/cvdef.h>
#include <opencv2/core.hpp>
#include <opencv2/core/affine.hpp>
...
...
modules/viz/src/viz.cpp
View file @
6ca1822f
...
...
@@ -18,3 +18,22 @@ cv::Affine3f cv::viz::makeTransformToGlobal(const Vec3f& axis_x, const Vec3f& ax
return
Affine3f
(
R
,
origin
);
}
vtkSmartPointer
<
vtkMatrix4x4
>
cv
::
viz
::
convertToVtkMatrix
(
const
cv
::
Matx44f
&
m
)
{
vtkSmartPointer
<
vtkMatrix4x4
>
vtk_matrix
=
vtkSmartPointer
<
vtkMatrix4x4
>::
New
();
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
k
=
0
;
k
<
4
;
k
++
)
vtk_matrix
->
SetElement
(
i
,
k
,
m
(
i
,
k
));
return
vtk_matrix
;
}
cv
::
Matx44f
cv
::
viz
::
convertToMatx
(
const
vtkSmartPointer
<
vtkMatrix4x4
>&
vtk_matrix
)
{
cv
::
Matx44f
m
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
k
=
0
;
k
<
4
;
k
++
)
m
(
i
,
k
)
=
vtk_matrix
->
GetElement
(
i
,
k
);
return
m
;
}
modules/viz/src/viz3d_impl.cpp
View file @
6ca1822f
...
...
@@ -626,11 +626,9 @@ void cv::viz::Viz3d::VizImpl::resetCamera ()
renderer_
->
ResetCamera
();
}
/////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setCameraPosition
(
const
cv
::
Vec3d
&
pos
,
const
cv
::
Vec3d
&
view
,
const
cv
::
Vec3d
&
up
)
{
vtkSmartPointer
<
vtkCamera
>
cam
=
renderer_
->
GetActiveCamera
();
cam
->
SetPosition
(
pos
[
0
],
pos
[
1
],
pos
[
2
]);
cam
->
SetFocalPoint
(
view
[
0
],
view
[
1
],
view
[
2
]);
...
...
@@ -642,13 +640,10 @@ void cv::viz::Viz3d::VizImpl::setCameraPosition (const cv::Vec3d& pos, const cv:
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setCameraPosition
(
double
pos_x
,
double
pos_y
,
double
pos_z
,
double
up_x
,
double
up_y
,
double
up_z
)
{
//rens_->InitTraversal ();
vtkSmartPointer
<
vtkCamera
>
cam
=
renderer_
->
GetActiveCamera
();
cam
->
SetPosition
(
pos_x
,
pos_y
,
pos_z
);
cam
->
SetViewUp
(
up_x
,
up_y
,
up_z
);
renderer_
->
Render
();
}
/////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -980,20 +975,13 @@ void cv::viz::Viz3d::VizImpl::updateCells (vtkSmartPointer<vtkIdTypeArray> &cell
//////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
allocVtkPolyData
(
vtkSmartPointer
<
vtkAppendPolyData
>
&
polydata
)
{
polydata
=
vtkSmartPointer
<
vtkAppendPolyData
>::
New
();
}
//////////////////////////////////////////////////////////////////////////////////////////////
{
polydata
=
vtkSmartPointer
<
vtkAppendPolyData
>::
New
();
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
allocVtkPolyData
(
vtkSmartPointer
<
vtkPolyData
>
&
polydata
)
{
polydata
=
vtkSmartPointer
<
vtkPolyData
>::
New
();
}
//////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
allocVtkUnstructuredGrid
(
vtkSmartPointer
<
vtkUnstructuredGrid
>
&
polydata
)
{
polydata
=
vtkSmartPointer
<
vtkUnstructuredGrid
>::
New
();
}
{
polydata
=
vtkSmartPointer
<
vtkPolyData
>::
New
();
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
allocVtkUnstructuredGrid
(
vtkSmartPointer
<
vtkUnstructuredGrid
>
&
polydata
)
{
polydata
=
vtkSmartPointer
<
vtkUnstructuredGrid
>::
New
();
}
//////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
convertToVtkMatrix
(
const
Eigen
::
Vector4f
&
origin
,
const
Eigen
::
Quaternion
<
float
>
&
orientation
,
vtkSmartPointer
<
vtkMatrix4x4
>
&
vtk_matrix
)
...
...
@@ -1011,23 +999,6 @@ void cv::viz::convertToVtkMatrix (const Eigen::Vector4f &origin, const Eigen::Qu
vtk_matrix
->
SetElement
(
3
,
3
,
1.0
f
);
}
vtkSmartPointer
<
vtkMatrix4x4
>
cv
::
viz
::
convertToVtkMatrix
(
const
cv
::
Matx44f
&
m
)
{
vtkSmartPointer
<
vtkMatrix4x4
>
vtk_matrix
=
vtkSmartPointer
<
vtkMatrix4x4
>::
New
();
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
k
=
0
;
k
<
4
;
k
++
)
vtk_matrix
->
SetElement
(
i
,
k
,
m
(
i
,
k
));
return
vtk_matrix
;
}
cv
::
Matx44f
cv
::
viz
::
convertToMatx
(
const
vtkSmartPointer
<
vtkMatrix4x4
>&
vtk_matrix
)
{
cv
::
Matx44f
m
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
k
=
0
;
k
<
4
;
k
++
)
m
(
i
,
k
)
=
vtk_matrix
->
GetElement
(
i
,
k
);
return
m
;
}
//////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -1043,8 +1014,8 @@ void cv::viz::Viz3d::VizImpl::setWindowName (const std::string &name)
window_
->
SetWindowName
(
name
.
c_str
());
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setPosition
(
int
x
,
int
y
)
{
window_
->
SetPosition
(
x
,
y
);
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setSize
(
int
xw
,
int
yw
)
{
window_
->
SetSize
(
xw
,
yw
);
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
set
Window
Position
(
int
x
,
int
y
)
{
window_
->
SetPosition
(
x
,
y
);
}
void
cv
::
viz
::
Viz3d
::
VizImpl
::
set
Window
Size
(
int
xw
,
int
yw
)
{
window_
->
SetSize
(
xw
,
yw
);
}
bool
cv
::
viz
::
Viz3d
::
VizImpl
::
addPolygonMesh
(
const
Mesh3d
&
mesh
,
const
Mat
&
mask
,
const
std
::
string
&
id
)
{
...
...
modules/viz/src/viz3d_impl.hpp
View file @
6ca1822f
This diff is collapsed.
Click to expand it.
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