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
f1c062c3
Commit
f1c062c3
authored
Feb 10, 2014
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cloud collection finalize
parent
5dc17f5d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
0 deletions
+29
-0
widget.rst
modules/viz/doc/widget.rst
+8
-0
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+2
-0
clouds.cpp
modules/viz/src/clouds.cpp
+18
-0
tests_simple.cpp
modules/viz/test/tests_simple.cpp
+1
-0
No files found.
modules/viz/doc/widget.rst
View file @
f1c062c3
...
...
@@ -934,6 +934,8 @@ This 3D Widget defines a collection of clouds. ::
void addCloud(InputArray cloud, InputArray colors, const Affine3d &pose = Affine3d::Identity());
//! All points in cloud have the same color
void addCloud(InputArray cloud, const Color &color = Color::white(), Affine3d &pose = Affine3d::Identity());
//! Repacks internal structure to sinle cloud
void finalize();
};
viz::WCloudCollection::WCloudCollection
...
...
@@ -964,6 +966,12 @@ Adds a cloud to the collection.
.. note:: In case there are four channels in the cloud, fourth channel is ignored.
viz::WCloudCollection::finalize
-------------------------------
Finalizes cloud data by repacking to single cloud. Useful for large cloud collections to reduce memory usage
.. ocv:function:: void finalize()
viz::WCloudNormals
------------------
.. ocv:class:: WCloudNormals
...
...
modules/viz/include/opencv2/viz/widgets.hpp
View file @
f1c062c3
...
...
@@ -345,6 +345,8 @@ namespace cv
void
addCloud
(
InputArray
cloud
,
InputArray
colors
,
const
Affine3d
&
pose
=
Affine3d
::
Identity
());
//! All points in cloud have the same color
void
addCloud
(
InputArray
cloud
,
const
Color
&
color
=
Color
::
white
(),
const
Affine3d
&
pose
=
Affine3d
::
Identity
());
//! Repacks internal structure to sinle cloud
void
finalize
();
};
class
CV_EXPORTS
WCloudNormals
:
public
Widget3D
...
...
modules/viz/src/clouds.cpp
View file @
f1c062c3
...
...
@@ -242,6 +242,24 @@ void cv::viz::WCloudCollection::addCloud(InputArray cloud, const Color &color, c
addCloud
(
cloud
,
Mat
(
cloud
.
size
(),
CV_8UC3
,
color
),
pose
);
}
void
cv
::
viz
::
WCloudCollection
::
finalize
()
{
vtkSmartPointer
<
vtkLODActor
>
actor
=
vtkLODActor
::
SafeDownCast
(
WidgetAccessor
::
getProp
(
*
this
));
CV_Assert
(
"Incompatible widget type."
&&
actor
);
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkPolyDataMapper
::
SafeDownCast
(
actor
->
GetMapper
());
CV_Assert
(
"Need to add at least one cloud."
&&
mapper
);
vtkSmartPointer
<
vtkAlgorithm
>
producer
=
mapper
->
GetInputConnection
(
0
,
0
)
->
GetProducer
();
vtkSmartPointer
<
vtkAppendPolyData
>
append_filter
=
vtkAppendPolyData
::
SafeDownCast
(
producer
);
append_filter
->
Update
();
vtkSmartPointer
<
vtkPolyData
>
polydata
=
append_filter
->
GetOutput
();
mapper
->
RemoveInputConnection
(
0
,
0
);
VtkUtils
::
SetInputData
(
mapper
,
polydata
);
mapper
->
Modified
();
}
template
<>
cv
::
viz
::
WCloudCollection
cv
::
viz
::
Widget
::
cast
<
cv
::
viz
::
WCloudCollection
>
()
{
Widget3D
widget
=
this
->
cast
<
Widget3D
>
();
...
...
modules/viz/test/tests_simple.cpp
View file @
f1c062c3
...
...
@@ -103,6 +103,7 @@ TEST(Viz, show_cloud_collection)
ccol
.
addCloud
(
cloud
,
Color
::
white
(),
Affine3d
().
translate
(
Vec3d
(
0
,
0
,
0
)).
rotate
(
Vec3d
(
CV_PI
/
2
,
0
,
0
)));
ccol
.
addCloud
(
cloud
,
Color
::
blue
(),
Affine3d
().
translate
(
Vec3d
(
1
,
0
,
0
)));
ccol
.
addCloud
(
cloud
,
Color
::
red
(),
Affine3d
().
translate
(
Vec3d
(
2
,
0
,
0
)));
ccol
.
finalize
();
Viz3d
viz
(
"show_cloud_collection"
);
viz
.
setBackgroundColor
(
Color
::
mlab
());
...
...
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