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
16155274
Commit
16155274
authored
Jan 01, 2014
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switched source to InputArrays
parent
f610c295
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
35 deletions
+34
-35
clouds.cpp
modules/viz/src/clouds.cpp
+3
-8
vizcore.cpp
modules/viz/src/vizcore.cpp
+1
-5
vtkCloudMatSource.cpp
modules/viz/src/vtk/vtkCloudMatSource.cpp
+27
-19
vtkCloudMatSource.h
modules/viz/src/vtk/vtkCloudMatSource.h
+3
-3
No files found.
modules/viz/src/clouds.cpp
View file @
16155274
...
...
@@ -56,12 +56,9 @@ namespace cv
///////////////////////////////////////////////////////////////////////////////////////////////
/// Point Cloud Widget implementation
cv
::
viz
::
WCloud
::
WCloud
(
InputArray
_cloud
,
InputArray
_
colors
)
cv
::
viz
::
WCloud
::
WCloud
(
InputArray
cloud
,
InputArray
colors
)
{
CV_Assert
(
!
_cloud
.
empty
()
&&
!
_colors
.
empty
());
Mat
cloud
=
_cloud
.
getMat
();
Mat
colors
=
_colors
.
getMat
();
CV_Assert
(
!
cloud
.
empty
()
&&
!
colors
.
empty
());
vtkSmartPointer
<
vtkCloudMatSource
>
cloud_source
=
vtkSmartPointer
<
vtkCloudMatSource
>::
New
();
cloud_source
->
SetColorCloud
(
cloud
,
colors
);
...
...
@@ -81,10 +78,8 @@ cv::viz::WCloud::WCloud(InputArray _cloud, InputArray _colors)
WidgetAccessor
::
setProp
(
*
this
,
actor
);
}
cv
::
viz
::
WCloud
::
WCloud
(
InputArray
_
cloud
,
const
Color
&
color
)
cv
::
viz
::
WCloud
::
WCloud
(
InputArray
cloud
,
const
Color
&
color
)
{
Mat
cloud
=
_cloud
.
getMat
();
vtkSmartPointer
<
vtkCloudMatSource
>
cloud_source
=
vtkSmartPointer
<
vtkCloudMatSource
>::
New
();
cloud_source
->
SetCloud
(
cloud
);
...
...
modules/viz/src/vizcore.cpp
View file @
16155274
...
...
@@ -164,15 +164,11 @@ void cv::viz::unregisterAllWindows() { VizStorage::unregisterAll(); }
///////////////////////////////////////////////////////////////////////////////////////////////
/// Read/write clouds. Supported formats: ply, stl, xyz, obj
void
cv
::
viz
::
writeCloud
(
const
String
&
file
,
InputArray
_cloud
,
InputArray
_colors
,
InputArray
_
normals
,
bool
binary
)
void
cv
::
viz
::
writeCloud
(
const
String
&
file
,
InputArray
cloud
,
InputArray
colors
,
InputArray
normals
,
bool
binary
)
{
CV_Assert
(
file
.
size
()
>
4
&&
"Extention is required"
);
String
extention
=
file
.
substr
(
file
.
size
()
-
4
);
Mat
cloud
=
_cloud
.
getMat
();
Mat
colors
=
_colors
.
getMat
();
Mat
normals
=
_normals
.
getMat
();
vtkSmartPointer
<
vtkCloudMatSource
>
source
=
vtkSmartPointer
<
vtkCloudMatSource
>::
New
();
source
->
SetColorCloudNormals
(
cloud
,
colors
,
normals
);
...
...
modules/viz/src/vtk/vtkCloudMatSource.cpp
View file @
16155274
...
...
@@ -71,12 +71,14 @@ namespace cv { namespace viz
cv
::
viz
::
vtkCloudMatSource
::
vtkCloudMatSource
()
{
SetNumberOfInputPorts
(
0
);
}
cv
::
viz
::
vtkCloudMatSource
::~
vtkCloudMatSource
()
{}
int
cv
::
viz
::
vtkCloudMatSource
::
SetCloud
(
const
Mat
&
cloud
)
int
cv
::
viz
::
vtkCloudMatSource
::
SetCloud
(
InputArray
_
cloud
)
{
CV_Assert
(
cloud
.
depth
()
==
CV_32F
||
cloud
.
depth
()
==
CV_64F
);
CV_Assert
(
cloud
.
channels
()
==
3
||
cloud
.
channels
()
==
4
);
CV_Assert
(
_cloud
.
depth
()
==
CV_32F
||
_
cloud
.
depth
()
==
CV_64F
);
CV_Assert
(
_cloud
.
channels
()
==
3
||
_
cloud
.
channels
()
==
4
);
int
total
=
cloud
.
depth
()
==
CV_32F
?
filterNanCopy
<
float
>
(
cloud
)
:
filterNanCopy
<
double
>
(
cloud
);
Mat
cloud
=
_cloud
.
getMat
();
int
total
=
_cloud
.
depth
()
==
CV_32F
?
filterNanCopy
<
float
>
(
cloud
)
:
filterNanCopy
<
double
>
(
cloud
);
vertices
=
vtkSmartPointer
<
vtkCellArray
>::
New
();
vertices
->
Allocate
(
vertices
->
EstimateSize
(
1
,
total
));
...
...
@@ -87,15 +89,18 @@ int cv::viz::vtkCloudMatSource::SetCloud(const Mat& cloud)
return
total
;
}
int
cv
::
viz
::
vtkCloudMatSource
::
SetColorCloud
(
const
Mat
&
cloud
,
const
Mat
&
colors
)
int
cv
::
viz
::
vtkCloudMatSource
::
SetColorCloud
(
InputArray
_cloud
,
InputArray
_
colors
)
{
int
total
=
SetCloud
(
cloud
);
int
total
=
SetCloud
(
_
cloud
);
if
(
colors
.
empty
())
if
(
_
colors
.
empty
())
return
total
;
CV_Assert
(
colors
.
depth
()
==
CV_8U
&&
colors
.
channels
()
<=
4
&&
colors
.
channels
()
!=
2
);
CV_Assert
(
colors
.
size
()
==
cloud
.
size
());
CV_Assert
(
_colors
.
depth
()
==
CV_8U
&&
_colors
.
channels
()
<=
4
&&
_colors
.
channels
()
!=
2
);
CV_Assert
(
_colors
.
size
()
==
_cloud
.
size
());
Mat
cloud
=
_cloud
.
getMat
();
Mat
colors
=
_colors
.
getMat
();
if
(
cloud
.
depth
()
==
CV_32F
)
filterNanColorsCopy
<
float
>
(
colors
,
cloud
,
total
);
...
...
@@ -105,25 +110,28 @@ int cv::viz::vtkCloudMatSource::SetColorCloud(const Mat &cloud, const Mat &color
return
total
;
}
int
cv
::
viz
::
vtkCloudMatSource
::
SetColorCloudNormals
(
const
Mat
&
cloud
,
const
Mat
&
colors
,
const
Mat
&
normals
)
int
cv
::
viz
::
vtkCloudMatSource
::
SetColorCloudNormals
(
InputArray
_cloud
,
InputArray
_colors
,
InputArray
_
normals
)
{
int
total
=
SetColorCloud
(
cloud
,
colors
);
int
total
=
SetColorCloud
(
_cloud
,
_
colors
);
if
(
normals
.
empty
())
if
(
_
normals
.
empty
())
return
total
;
CV_Assert
(
normals
.
depth
()
==
CV_32F
||
normals
.
depth
()
==
CV_64F
);
CV_Assert
(
normals
.
channels
()
==
3
||
normals
.
channels
()
==
4
);
CV_Assert
(
normals
.
size
()
==
cloud
.
size
());
CV_Assert
(
_normals
.
depth
()
==
CV_32F
||
_normals
.
depth
()
==
CV_64F
);
CV_Assert
(
_normals
.
channels
()
==
3
||
_normals
.
channels
()
==
4
);
CV_Assert
(
_normals
.
size
()
==
_cloud
.
size
());
Mat
cloud
=
_cloud
.
getMat
();
Mat
normals
=
_normals
.
getMat
();
if
(
normals
.
depth
()
==
CV_32F
&&
cloud
.
depth
()
==
CV_32F
)
filterNanNormalsCopy
<
float
,
float
>
(
color
s
,
cloud
,
total
);
filterNanNormalsCopy
<
float
,
float
>
(
normal
s
,
cloud
,
total
);
else
if
(
normals
.
depth
()
==
CV_32F
&&
cloud
.
depth
()
==
CV_64F
)
filterNanNormalsCopy
<
float
,
double
>
(
color
s
,
cloud
,
total
);
filterNanNormalsCopy
<
float
,
double
>
(
normal
s
,
cloud
,
total
);
else
if
(
normals
.
depth
()
==
CV_64F
&&
cloud
.
depth
()
==
CV_32F
)
filterNanNormalsCopy
<
double
,
float
>
(
color
s
,
cloud
,
total
);
filterNanNormalsCopy
<
double
,
float
>
(
normal
s
,
cloud
,
total
);
else
if
(
normals
.
depth
()
==
CV_64F
&&
cloud
.
depth
()
==
CV_64F
)
filterNanNormalsCopy
<
double
,
double
>
(
color
s
,
cloud
,
total
);
filterNanNormalsCopy
<
double
,
double
>
(
normal
s
,
cloud
,
total
);
else
CV_Assert
(
!
"Unsupported normals type"
);
...
...
modules/viz/src/vtk/vtkCloudMatSource.h
View file @
16155274
...
...
@@ -61,9 +61,9 @@ namespace cv
static
vtkCloudMatSource
*
New
();
vtkTypeMacro
(
vtkCloudMatSource
,
vtkPolyDataAlgorithm
);
virtual
int
SetCloud
(
const
Mat
&
cloud
);
virtual
int
SetColorCloud
(
const
Mat
&
cloud
,
const
Mat
&
colors
=
cv
::
Mat
());
virtual
int
SetColorCloudNormals
(
const
Mat
&
cloud
,
const
Mat
&
colors
=
cv
::
Mat
(),
const
Mat
&
normals
=
cv
::
Mat
());
virtual
int
SetCloud
(
InputArray
cloud
);
virtual
int
SetColorCloud
(
InputArray
cloud
,
InputArray
colors
=
noArray
());
virtual
int
SetColorCloudNormals
(
InputArray
cloud
,
InputArray
colors
=
noArray
(),
InputArray
normals
=
noArray
());
protected
:
vtkCloudMatSource
();
...
...
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