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
dc348ff9
Commit
dc348ff9
authored
Jul 15, 2013
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed Mesh::Ptr since mesh itself consists of shared points (cv::Mat)
parent
0e20473c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
15 deletions
+16
-15
types.hpp
modules/viz/include/opencv2/viz/types.hpp
+6
-5
types.cpp
modules/viz/src/types.cpp
+10
-10
No files found.
modules/viz/include/opencv2/viz/types.hpp
View file @
dc348ff9
...
@@ -35,9 +35,11 @@ namespace cv
...
@@ -35,9 +35,11 @@ namespace cv
class
CV_EXPORTS
Mesh3d
class
CV_EXPORTS
Mesh3d
{
{
public
:
public
:
typedef
cv
::
Ptr
<
Mesh3d
>
Ptr
;
Mat
cloud
,
colors
,
polygons
;
Mat
cloud
,
colors
;
static
cv
::
viz
::
Mesh3d
::
Ptr
loadMesh
(
const
String
&
file
);
Mat
polygons
;
static
cv
::
viz
::
Mesh3d
loadMesh
(
const
String
&
file
);
private
:
private
:
struct
loadMeshImpl
;
struct
loadMeshImpl
;
...
@@ -93,4 +95,4 @@ namespace cv
...
@@ -93,4 +95,4 @@ namespace cv
};
};
}
/* namespace viz */
}
/* namespace viz */
}
/* namespace cv */
}
/* namespace cv */
\ No newline at end of file
modules/viz/src/types.cpp
View file @
dc348ff9
...
@@ -65,9 +65,9 @@ cv::viz::MouseEvent::MouseEvent (const Type& _type, const MouseButton& _button,
...
@@ -65,9 +65,9 @@ cv::viz::MouseEvent::MouseEvent (const Type& _type, const MouseButton& _button,
struct
cv
::
viz
::
Mesh3d
::
loadMeshImpl
struct
cv
::
viz
::
Mesh3d
::
loadMeshImpl
{
{
static
cv
::
viz
::
Mesh3d
::
Ptr
loadMesh
(
const
String
&
file
)
static
cv
::
viz
::
Mesh3d
loadMesh
(
const
String
&
file
)
{
{
Mesh3d
::
Ptr
mesh
=
new
Mesh3d
()
;
Mesh3d
mesh
;
vtkSmartPointer
<
vtkPLYReader
>
reader
=
vtkSmartPointer
<
vtkPLYReader
>::
New
();
vtkSmartPointer
<
vtkPLYReader
>
reader
=
vtkSmartPointer
<
vtkPLYReader
>::
New
();
reader
->
SetFileName
(
file
.
c_str
());
reader
->
SetFileName
(
file
.
c_str
());
...
@@ -78,9 +78,9 @@ struct cv::viz::Mesh3d::loadMeshImpl
...
@@ -78,9 +78,9 @@ struct cv::viz::Mesh3d::loadMeshImpl
vtkIdType
nr_points
=
mesh_points
->
GetNumberOfPoints
();
vtkIdType
nr_points
=
mesh_points
->
GetNumberOfPoints
();
//vtkIdType nr_polygons = poly_data->GetNumberOfPolys ();
//vtkIdType nr_polygons = poly_data->GetNumberOfPolys ();
mesh
->
cloud
.
create
(
1
,
nr_points
,
CV_32FC3
);
mesh
.
cloud
.
create
(
1
,
nr_points
,
CV_32FC3
);
Vec3f
*
mesh_cloud
=
mesh
->
cloud
.
ptr
<
Vec3f
>
();
Vec3f
*
mesh_cloud
=
mesh
.
cloud
.
ptr
<
Vec3f
>
();
for
(
vtkIdType
i
=
0
;
i
<
mesh_points
->
GetNumberOfPoints
();
i
++
)
for
(
vtkIdType
i
=
0
;
i
<
mesh_points
->
GetNumberOfPoints
();
i
++
)
{
{
Vec3d
point
;
Vec3d
point
;
...
@@ -103,8 +103,8 @@ struct cv::viz::Mesh3d::loadMeshImpl
...
@@ -103,8 +103,8 @@ struct cv::viz::Mesh3d::loadMeshImpl
// TODO: currently only handles rgb values with 3 components
// TODO: currently only handles rgb values with 3 components
if
(
poly_colors
&&
(
poly_colors
->
GetNumberOfComponents
()
==
3
))
if
(
poly_colors
&&
(
poly_colors
->
GetNumberOfComponents
()
==
3
))
{
{
mesh
->
colors
.
create
(
1
,
nr_points
,
CV_8UC3
);
mesh
.
colors
.
create
(
1
,
nr_points
,
CV_8UC3
);
Vec3b
*
mesh_colors
=
mesh
->
colors
.
ptr
<
cv
::
Vec3b
>
();
Vec3b
*
mesh_colors
=
mesh
.
colors
.
ptr
<
cv
::
Vec3b
>
();
for
(
vtkIdType
i
=
0
;
i
<
mesh_points
->
GetNumberOfPoints
();
i
++
)
for
(
vtkIdType
i
=
0
;
i
<
mesh_points
->
GetNumberOfPoints
();
i
++
)
{
{
...
@@ -116,7 +116,7 @@ struct cv::viz::Mesh3d::loadMeshImpl
...
@@ -116,7 +116,7 @@ struct cv::viz::Mesh3d::loadMeshImpl
}
}
}
}
else
else
mesh
->
colors
.
release
();
mesh
.
colors
.
release
();
// Now handle the polygons
// Now handle the polygons
vtkIdType
*
cell_points
;
vtkIdType
*
cell_points
;
...
@@ -124,9 +124,9 @@ struct cv::viz::Mesh3d::loadMeshImpl
...
@@ -124,9 +124,9 @@ struct cv::viz::Mesh3d::loadMeshImpl
vtkCellArray
*
mesh_polygons
=
poly_data
->
GetPolys
();
vtkCellArray
*
mesh_polygons
=
poly_data
->
GetPolys
();
mesh_polygons
->
InitTraversal
();
mesh_polygons
->
InitTraversal
();
mesh
->
polygons
.
create
(
1
,
mesh_polygons
->
GetSize
(),
CV_32SC1
);
mesh
.
polygons
.
create
(
1
,
mesh_polygons
->
GetSize
(),
CV_32SC1
);
int
*
polygons
=
mesh
->
polygons
.
ptr
<
int
>
();
int
*
polygons
=
mesh
.
polygons
.
ptr
<
int
>
();
while
(
mesh_polygons
->
GetNextCell
(
nr_cell_points
,
cell_points
))
while
(
mesh_polygons
->
GetNextCell
(
nr_cell_points
,
cell_points
))
{
{
*
polygons
++
=
nr_cell_points
;
*
polygons
++
=
nr_cell_points
;
...
@@ -138,7 +138,7 @@ struct cv::viz::Mesh3d::loadMeshImpl
...
@@ -138,7 +138,7 @@ struct cv::viz::Mesh3d::loadMeshImpl
}
}
};
};
cv
::
viz
::
Mesh3d
::
Ptr
cv
::
viz
::
Mesh3d
::
loadMesh
(
const
String
&
file
)
cv
::
viz
::
Mesh3d
cv
::
viz
::
Mesh3d
::
loadMesh
(
const
String
&
file
)
{
{
return
loadMeshImpl
::
loadMesh
(
file
);
return
loadMeshImpl
::
loadMesh
(
file
);
}
}
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