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
8309d19f
Commit
8309d19f
authored
Jan 09, 2014
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed Mesh3d -> Mesh
parent
d591bd87
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
57 deletions
+60
-57
viz3d.rst
modules/viz/doc/viz3d.rst
+10
-10
widget.rst
modules/viz/doc/widget.rst
+14
-24
viz.hpp
modules/viz/include/opencv2/viz.hpp
+1
-1
types.hpp
modules/viz/include/opencv2/viz/types.hpp
+12
-10
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+2
-1
clouds.cpp
modules/viz/src/clouds.cpp
+13
-3
types.cpp
modules/viz/src/types.cpp
+3
-3
vizcore.cpp
modules/viz/src/vizcore.cpp
+1
-1
tests_simple.cpp
modules/viz/test/tests_simple.cpp
+4
-4
No files found.
modules/viz/doc/viz3d.rst
View file @
8309d19f
...
@@ -468,31 +468,31 @@ This class a represents BGR color. ::
...
@@ -468,31 +468,31 @@ This class a represents BGR color. ::
static Color gray();
static Color gray();
};
};
viz::Mesh
3d
viz::Mesh
-----------
-----------
.. ocv:class:: Mesh
3d
.. ocv:class:: Mesh
This class wraps mesh attributes, and it can load a mesh from a ``ply`` file. ::
This class wraps mesh attributes, and it can load a mesh from a ``ply`` file. ::
class CV_EXPORTS Mesh
3d
class CV_EXPORTS Mesh
{
{
public:
public:
Mat cloud, colors;
Mat cloud, colors, normals;
//! Raw integer list of the form: (n,id1,id2,...,idn, n,id1,id2,...,idn, ...)
//! where n is the number of points in the poligon, and id is a zero-offset index into an associated cloud.
Mat polygons;
Mat polygons;
//! Loads mesh from a given ply file
//! Loads mesh from a given ply file
static Mesh3d load(const String& file);
static Mesh load(const String& file);
private:
/* hidden */
};
};
viz::Mesh
3d
::load
viz::Mesh::load
---------------------
---------------------
Loads a mesh from a ``ply`` file.
Loads a mesh from a ``ply`` file.
.. ocv:function:: static Mesh
3d
load(const String& file)
.. ocv:function:: static Mesh load(const String& file)
:param file: File name (for no only PLY is supported)
:param file: File name (for no only PLY is supported)
...
...
modules/viz/doc/widget.rst
View file @
8309d19f
...
@@ -264,8 +264,6 @@ This 3D Widget defines a finite plane. ::
...
@@ -264,8 +264,6 @@ This 3D Widget defines a finite plane. ::
public:
public:
WPlane(const Vec4d& coefs, double size = 1.0, const Color &color = Color::white());
WPlane(const Vec4d& coefs, double size = 1.0, const Color &color = Color::white());
WPlane(const Vec4d& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white());
WPlane(const Vec4d& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white());
private:
/* hidden */
};
};
viz::WPlane::WPlane
viz::WPlane::WPlane
...
@@ -437,9 +435,6 @@ This 3D Widget defines a poly line. ::
...
@@ -437,9 +435,6 @@ This 3D Widget defines a poly line. ::
{
{
public:
public:
WPolyLine(InputArray points, const Color &color = Color::white());
WPolyLine(InputArray points, const Color &color = Color::white());
private:
/* hidden */
};
};
viz::WPolyLine::WPolyLine
viz::WPolyLine::WPolyLine
...
@@ -464,8 +459,6 @@ This 3D Widget defines a grid. ::
...
@@ -464,8 +459,6 @@ This 3D Widget defines a grid. ::
WGrid(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
WGrid(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
//! Creates grid based on the plane equation
//! Creates grid based on the plane equation
WGrid(const Vec4d &coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
WGrid(const Vec4d &coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
private:
/* hidden */
};
};
viz::WGrid::WGrid
viz::WGrid::WGrid
...
@@ -732,14 +725,14 @@ This 3D Widget represents a trajectory. ::
...
@@ -732,14 +725,14 @@ This 3D Widget represents a trajectory. ::
enum {FRAMES = 1, PATH = 2, BOTH = FRAMES + PATH};
enum {FRAMES = 1, PATH = 2, BOTH = FRAMES + PATH};
//! Displays trajectory of the given path either by coordinate frames or polyline
//! Displays trajectory of the given path either by coordinate frames or polyline
WTrajectory(InputArray path, int display_mode = WTrajectory::PATH, double scale = 1.
f
, const Color &color = Color::white(),;
WTrajectory(InputArray path, int display_mode = WTrajectory::PATH, double scale = 1.
0
, const Color &color = Color::white(),;
};
};
viz::WTrajectory::WTrajectory
viz::WTrajectory::WTrajectory
-----------------------------
-----------------------------
Constructs a WTrajectory.
Constructs a WTrajectory.
.. ocv:function:: WTrajectory(InputArray path, int display_mode = WTrajectory::PATH, double scale = 1.
f
, const Color &color = Color::white())
.. ocv:function:: WTrajectory(InputArray path, int display_mode = WTrajectory::PATH, double scale = 1.
0
, const Color &color = Color::white())
:param path: List of poses on a trajectory. Takes std::vector<Affine<T>> with T == [float | double]
:param path: List of poses on a trajectory. Takes std::vector<Affine<T>> with T == [float | double]
:param display_mode: Display mode. This can be PATH, FRAMES, and BOTH.
:param display_mode: Display mode. This can be PATH, FRAMES, and BOTH.
...
@@ -828,9 +821,6 @@ This 3D Widget defines a point cloud. ::
...
@@ -828,9 +821,6 @@ This 3D Widget defines a point cloud. ::
WCloud(InputArray cloud, InputArray colors);
WCloud(InputArray cloud, InputArray colors);
//! All points in cloud have the same color
//! All points in cloud have the same color
WCloud(InputArray cloud, const Color &color = Color::white());
WCloud(InputArray cloud, const Color &color = Color::white());
private:
/* hidden */
};
};
viz::WCloud::WCloud
viz::WCloud::WCloud
...
@@ -868,9 +858,6 @@ This 3D Widget defines a collection of clouds. ::
...
@@ -868,9 +858,6 @@ This 3D Widget defines a collection of clouds. ::
void addCloud(InputArray cloud, InputArray colors, const Affine3d &pose = Affine3d::Identity());
void addCloud(InputArray cloud, InputArray colors, const Affine3d &pose = Affine3d::Identity());
//! All points in cloud have the same color
//! All points in cloud have the same color
void addCloud(InputArray cloud, const Color &color = Color::white(), Affine3d &pose = Affine3d::Identity());
void addCloud(InputArray cloud, const Color &color = Color::white(), Affine3d &pose = Affine3d::Identity());
private:
/* hidden */
};
};
viz::WCloudCollection::WCloudCollection
viz::WCloudCollection::WCloudCollection
...
@@ -911,9 +898,6 @@ This 3D Widget represents normals of a point cloud. ::
...
@@ -911,9 +898,6 @@ This 3D Widget represents normals of a point cloud. ::
{
{
public:
public:
WCloudNormals(InputArray cloud, InputArray normals, int level = 100, double scale = 0.02f, const Color &color = Color::white());
WCloudNormals(InputArray cloud, InputArray normals, int level = 100, double scale = 0.02f, const Color &color = Color::white());
private:
/* hidden */
};
};
viz::WCloudNormals::WCloudNormals
viz::WCloudNormals::WCloudNormals
...
@@ -939,16 +923,22 @@ This 3D Widget defines a mesh. ::
...
@@ -939,16 +923,22 @@ This 3D Widget defines a mesh. ::
class CV_EXPORTS WMesh : public Widget3D
class CV_EXPORTS WMesh : public Widget3D
{
{
public:
public:
WMesh(const Mesh3d &mesh);
WMesh(const Mesh &mesh);
WMesh(InputArray cloud, InputArray polygons, InputArray colors = noArray(), InputArray normals = noArray());
private:
/* hidden */
};
};
viz::WMesh::WMesh
viz::WMesh::WMesh
-----------------
-----------------
Constructs a WMesh.
Constructs a WMesh.
.. ocv:function:: WMesh(const Mesh3d &mesh)
.. ocv:function:: WMesh(const Mesh &mesh)
:param mesh: :ocv:class:`Mesh` object that will be displayed.
.. ocv:function:: WMesh(InputArray cloud, InputArray polygons, InputArray colors = noArray(), InputArray normals = noArray());
:param cloud: Points of the mesh object.
:param polygons: Points of the mesh object.
:param colors: Point colors.
:param normals: Point normals.
:param mesh: :ocv:class:`Mesh3d` object that will be displayed.
modules/viz/include/opencv2/viz.hpp
View file @
8309d19f
...
@@ -111,7 +111,7 @@ namespace cv
...
@@ -111,7 +111,7 @@ namespace cv
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
/// Computing normals for mesh
/// Computing normals for mesh
CV_EXPORTS
void
computeNormals
(
const
Mesh
3d
&
mesh
,
OutputArray
normals
);
CV_EXPORTS
void
computeNormals
(
const
Mesh
&
mesh
,
OutputArray
normals
);
}
/* namespace viz */
}
/* namespace viz */
}
/* namespace cv */
}
/* namespace cv */
...
...
modules/viz/include/opencv2/viz/types.hpp
View file @
8309d19f
...
@@ -104,15 +104,17 @@ namespace cv
...
@@ -104,15 +104,17 @@ namespace cv
static
Color
amethyst
();
static
Color
amethyst
();
};
};
class
CV_EXPORTS
Mesh
3d
class
CV_EXPORTS
Mesh
{
{
public
:
public
:
Mat
cloud
,
colors
,
normals
;
Mat
cloud
,
colors
,
normals
;
//! Raw integer list of the form: (n,id1,id2,...,idn, n,id1,id2,...,idn, ...)
//! where n is the number of points in the poligon, and id is a zero-offset index into an associated cloud.
Mat
polygons
;
Mat
polygons
;
//! Loads mesh from a given ply file
//! Loads mesh from a given ply file
static
Mesh
3d
load
(
const
String
&
file
);
static
Mesh
load
(
const
String
&
file
);
};
};
class
CV_EXPORTS
Camera
class
CV_EXPORTS
Camera
...
@@ -123,17 +125,17 @@ namespace cv
...
@@ -123,17 +125,17 @@ namespace cv
explicit
Camera
(
const
Matx33d
&
K
,
const
Size
&
window_size
);
explicit
Camera
(
const
Matx33d
&
K
,
const
Size
&
window_size
);
explicit
Camera
(
const
Matx44d
&
proj
,
const
Size
&
window_size
);
explicit
Camera
(
const
Matx44d
&
proj
,
const
Size
&
window_size
);
inline
const
Vec2d
&
getClip
()
const
{
return
clip_
;
}
const
Vec2d
&
getClip
()
const
{
return
clip_
;
}
inline
void
setClip
(
const
Vec2d
&
clip
)
{
clip_
=
clip
;
}
void
setClip
(
const
Vec2d
&
clip
)
{
clip_
=
clip
;
}
inline
const
Size
&
getWindowSize
()
const
{
return
window_size_
;
}
const
Size
&
getWindowSize
()
const
{
return
window_size_
;
}
void
setWindowSize
(
const
Size
&
window_size
);
void
setWindowSize
(
const
Size
&
window_size
);
inline
const
Vec2d
&
getFov
()
const
{
return
fov_
;
}
const
Vec2d
&
getFov
()
const
{
return
fov_
;
}
inline
void
setFov
(
const
Vec2d
&
fov
)
{
fov_
=
fov
;
}
void
setFov
(
const
Vec2d
&
fov
)
{
fov_
=
fov
;
}
inline
const
Vec2d
&
getPrincipalPoint
()
const
{
return
principal_point_
;
}
const
Vec2d
&
getPrincipalPoint
()
const
{
return
principal_point_
;
}
inline
const
Vec2d
&
getFocalLength
()
const
{
return
focal_
;
}
const
Vec2d
&
getFocalLength
()
const
{
return
focal_
;
}
void
computeProjectionMatrix
(
Matx44d
&
proj
)
const
;
void
computeProjectionMatrix
(
Matx44d
&
proj
)
const
;
...
...
modules/viz/include/opencv2/viz/widgets.hpp
View file @
8309d19f
...
@@ -316,7 +316,8 @@ namespace cv
...
@@ -316,7 +316,8 @@ namespace cv
class
CV_EXPORTS
WMesh
:
public
Widget3D
class
CV_EXPORTS
WMesh
:
public
Widget3D
{
{
public
:
public
:
WMesh
(
const
Mesh3d
&
mesh
);
WMesh
(
const
Mesh
&
mesh
);
WMesh
(
InputArray
cloud
,
InputArray
polygons
,
InputArray
colors
=
noArray
(),
InputArray
normals
=
noArray
());
};
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
...
...
modules/viz/src/clouds.cpp
View file @
8309d19f
...
@@ -257,7 +257,7 @@ template<> cv::viz::WCloudNormals cv::viz::Widget::cast<cv::viz::WCloudNormals>(
...
@@ -257,7 +257,7 @@ template<> cv::viz::WCloudNormals cv::viz::Widget::cast<cv::viz::WCloudNormals>(
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
/// Mesh Widget implementation
/// Mesh Widget implementation
cv
::
viz
::
WMesh
::
WMesh
(
const
Mesh
3d
&
mesh
)
cv
::
viz
::
WMesh
::
WMesh
(
const
Mesh
&
mesh
)
{
{
CV_Assert
(
mesh
.
cloud
.
rows
==
1
&&
mesh
.
polygons
.
type
()
==
CV_32SC1
);
CV_Assert
(
mesh
.
cloud
.
rows
==
1
&&
mesh
.
polygons
.
type
()
==
CV_32SC1
);
...
@@ -300,8 +300,8 @@ cv::viz::WMesh::WMesh(const Mesh3d &mesh)
...
@@ -300,8 +300,8 @@ cv::viz::WMesh::WMesh(const Mesh3d &mesh)
vtkSmartPointer
<
vtkCellArray
>
cell_array
=
vtkSmartPointer
<
vtkCellArray
>::
New
();
vtkSmartPointer
<
vtkCellArray
>
cell_array
=
vtkSmartPointer
<
vtkCellArray
>::
New
();
int
idx
=
0
;
int
idx
=
0
;
int
poly
_size
=
mesh
.
polygons
.
total
();
size_t
polygons
_size
=
mesh
.
polygons
.
total
();
for
(
int
i
=
0
;
i
<
poly
_size
;
++
idx
)
for
(
size_t
i
=
0
;
i
<
polygons
_size
;
++
idx
)
{
{
int
n_points
=
polygons
[
i
++
];
int
n_points
=
polygons
[
i
++
];
...
@@ -330,6 +330,16 @@ cv::viz::WMesh::WMesh(const Mesh3d &mesh)
...
@@ -330,6 +330,16 @@ cv::viz::WMesh::WMesh(const Mesh3d &mesh)
WidgetAccessor
::
setProp
(
*
this
,
actor
);
WidgetAccessor
::
setProp
(
*
this
,
actor
);
}
}
cv
::
viz
::
WMesh
::
WMesh
(
InputArray
cloud
,
InputArray
polygons
,
InputArray
colors
,
InputArray
normals
)
{
Mesh
mesh
;
mesh
.
cloud
=
cloud
.
getMat
();
mesh
.
colors
=
colors
.
getMat
();
mesh
.
normals
=
normals
.
getMat
();
mesh
.
polygons
=
polygons
.
getMat
();
*
this
=
WMesh
(
mesh
);
}
template
<>
CV_EXPORTS
cv
::
viz
::
WMesh
cv
::
viz
::
Widget
::
cast
<
cv
::
viz
::
WMesh
>
()
template
<>
CV_EXPORTS
cv
::
viz
::
WMesh
cv
::
viz
::
Widget
::
cast
<
cv
::
viz
::
WMesh
>
()
{
{
Widget3D
widget
=
this
->
cast
<
Widget3D
>
();
Widget3D
widget
=
this
->
cast
<
Widget3D
>
();
...
...
modules/viz/src/types.cpp
View file @
8309d19f
...
@@ -61,9 +61,9 @@ namespace cv { namespace viz { namespace
...
@@ -61,9 +61,9 @@ namespace cv { namespace viz { namespace
{
{
struct
MeshUtils
struct
MeshUtils
{
{
static
Mesh
3d
loadMesh
(
const
String
&
file
)
static
Mesh
loadMesh
(
const
String
&
file
)
{
{
Mesh
3d
mesh
;
Mesh
mesh
;
vtkSmartPointer
<
vtkPLYReader
>
reader
=
vtkSmartPointer
<
vtkPLYReader
>::
New
();
vtkSmartPointer
<
vtkPLYReader
>
reader
=
vtkSmartPointer
<
vtkPLYReader
>::
New
();
reader
->
SetFileName
(
file
.
c_str
());
reader
->
SetFileName
(
file
.
c_str
());
...
@@ -128,7 +128,7 @@ namespace cv { namespace viz { namespace
...
@@ -128,7 +128,7 @@ namespace cv { namespace viz { namespace
};
};
}}}
}}}
cv
::
viz
::
Mesh
3d
cv
::
viz
::
Mesh3d
::
load
(
const
String
&
file
)
cv
::
viz
::
Mesh
cv
::
viz
::
Mesh
::
load
(
const
String
&
file
)
{
{
return
MeshUtils
::
loadMesh
(
file
);
return
MeshUtils
::
loadMesh
(
file
);
}
}
...
...
modules/viz/src/vizcore.cpp
View file @
8309d19f
...
@@ -282,7 +282,7 @@ void cv::viz::writeTrajectory(InputArray _traj, const String& files_format, int
...
@@ -282,7 +282,7 @@ void cv::viz::writeTrajectory(InputArray _traj, const String& files_format, int
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
/// Computing normals for mesh
/// Computing normals for mesh
void
cv
::
viz
::
computeNormals
(
const
Mesh
3d
&
mesh
,
OutputArray
_normals
)
void
cv
::
viz
::
computeNormals
(
const
Mesh
&
mesh
,
OutputArray
_normals
)
{
{
vtkSmartPointer
<
vtkPolyData
>
polydata
=
getPolyData
(
WMesh
(
mesh
));
vtkSmartPointer
<
vtkPolyData
>
polydata
=
getPolyData
(
WMesh
(
mesh
));
vtkSmartPointer
<
vtkPolyData
>
with_normals
=
VtkUtils
::
ComputeNormals
(
polydata
);
vtkSmartPointer
<
vtkPolyData
>
with_normals
=
VtkUtils
::
ComputeNormals
(
polydata
);
...
...
modules/viz/test/tests_simple.cpp
View file @
8309d19f
...
@@ -106,7 +106,7 @@ TEST(Viz, DISABLED_show_cloud_collection)
...
@@ -106,7 +106,7 @@ TEST(Viz, DISABLED_show_cloud_collection)
TEST
(
Viz
,
DISABLED_show_mesh
)
TEST
(
Viz
,
DISABLED_show_mesh
)
{
{
Mesh
3d
mesh
=
Mesh3d
::
load
(
get_dragon_ply_file_path
());
Mesh
mesh
=
Mesh
::
load
(
get_dragon_ply_file_path
());
Affine3d
pose
=
Affine3d
().
rotate
(
Vec3d
(
0
,
0.8
,
0
));
Affine3d
pose
=
Affine3d
().
rotate
(
Vec3d
(
0
,
0.8
,
0
));
...
@@ -118,7 +118,7 @@ TEST(Viz, DISABLED_show_mesh)
...
@@ -118,7 +118,7 @@ TEST(Viz, DISABLED_show_mesh)
TEST
(
Viz
,
DISABLED_show_mesh_random_colors
)
TEST
(
Viz
,
DISABLED_show_mesh_random_colors
)
{
{
Mesh
3d
mesh
=
Mesh3d
::
load
(
get_dragon_ply_file_path
());
Mesh
mesh
=
Mesh
::
load
(
get_dragon_ply_file_path
());
theRNG
().
fill
(
mesh
.
colors
,
RNG
::
UNIFORM
,
0
,
255
);
theRNG
().
fill
(
mesh
.
colors
,
RNG
::
UNIFORM
,
0
,
255
);
Affine3d
pose
=
Affine3d
().
rotate
(
Vec3d
(
0
,
0.8
,
0
));
Affine3d
pose
=
Affine3d
().
rotate
(
Vec3d
(
0
,
0.8
,
0
));
...
@@ -144,7 +144,7 @@ TEST(Viz, DISABLED_show_polyline)
...
@@ -144,7 +144,7 @@ TEST(Viz, DISABLED_show_polyline)
TEST
(
Viz
,
DISABLED_show_sampled_normals
)
TEST
(
Viz
,
DISABLED_show_sampled_normals
)
{
{
Mesh
3d
mesh
=
Mesh3d
::
load
(
get_dragon_ply_file_path
());
Mesh
mesh
=
Mesh
::
load
(
get_dragon_ply_file_path
());
computeNormals
(
mesh
,
mesh
.
normals
);
computeNormals
(
mesh
,
mesh
.
normals
);
Affine3d
pose
=
Affine3d
().
rotate
(
Vec3d
(
0
,
0.8
,
0
));
Affine3d
pose
=
Affine3d
().
rotate
(
Vec3d
(
0
,
0.8
,
0
));
...
@@ -201,7 +201,7 @@ TEST(Viz, DISABLED_show_trajectory_reposition)
...
@@ -201,7 +201,7 @@ TEST(Viz, DISABLED_show_trajectory_reposition)
TEST
(
Viz
,
DISABLED_spin_twice_____________________________TODO_UI_BUG
)
TEST
(
Viz
,
DISABLED_spin_twice_____________________________TODO_UI_BUG
)
{
{
Mesh
3d
mesh
=
Mesh3d
::
load
(
get_dragon_ply_file_path
());
Mesh
mesh
=
Mesh
::
load
(
get_dragon_ply_file_path
());
Viz3d
viz
(
"spin_twice"
);
Viz3d
viz
(
"spin_twice"
);
viz
.
showWidget
(
"coosys"
,
WCoordinateSystem
());
viz
.
showWidget
(
"coosys"
,
WCoordinateSystem
());
...
...
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