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
17fea0dd
Commit
17fea0dd
authored
Feb 02, 2014
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed size_t/int conversion warnings
parent
998aefd1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
34 deletions
+35
-34
clouds.cpp
modules/viz/src/clouds.cpp
+1
-1
precomp.hpp
modules/viz/src/precomp.hpp
+2
-2
shapes.cpp
modules/viz/src/shapes.cpp
+6
-6
vizcore.cpp
modules/viz/src/vizcore.cpp
+2
-2
vtkCloudMatSink.cpp
modules/viz/src/vtk/vtkCloudMatSink.cpp
+5
-5
vtkCloudMatSource.cpp
modules/viz/src/vtk/vtkCloudMatSource.cpp
+2
-2
vtkTrajectorySource.cpp
modules/viz/src/vtk/vtkTrajectorySource.cpp
+5
-5
tests_simple.cpp
modules/viz/test/tests_simple.cpp
+12
-11
No files found.
modules/viz/src/clouds.cpp
View file @
17fea0dd
...
...
@@ -347,7 +347,7 @@ cv::viz::WMesh::WMesh(const Mesh &mesh)
source
->
SetColorCloudNormalsTCoords
(
mesh
.
cloud
,
mesh
.
colors
,
mesh
.
normals
,
mesh
.
tcoords
);
source
->
Update
();
Mat
lookup_buffer
(
1
,
mesh
.
cloud
.
total
(),
CV_32SC1
);
Mat
lookup_buffer
(
1
,
(
int
)
mesh
.
cloud
.
total
(),
CV_32SC1
);
int
*
lookup
=
lookup_buffer
.
ptr
<
int
>
();
for
(
int
y
=
0
,
index
=
0
;
y
<
mesh
.
cloud
.
rows
;
++
y
)
{
...
...
modules/viz/src/precomp.hpp
View file @
17fea0dd
...
...
@@ -267,8 +267,8 @@ namespace cv
vtkSmartPointer
<
vtkUnsignedCharArray
>
scalars
=
vtkSmartPointer
<
vtkUnsignedCharArray
>::
New
();
scalars
->
SetName
(
"Colors"
);
scalars
->
SetNumberOfComponents
(
3
);
scalars
->
SetNumberOfTuples
(
size
);
scalars
->
SetArray
(
color_data
->
val
,
size
*
3
,
0
);
scalars
->
SetNumberOfTuples
(
(
vtkIdType
)
size
);
scalars
->
SetArray
(
color_data
->
val
,
(
vtkIdType
)(
size
*
3
)
,
0
);
return
scalars
;
}
...
...
modules/viz/src/shapes.cpp
View file @
17fea0dd
...
...
@@ -390,21 +390,21 @@ cv::viz::WPolyLine::WPolyLine(InputArray _points, const Color &color)
vtkSmartPointer
<
vtkPoints
>
points
=
vtkSmartPointer
<
vtkPoints
>::
New
();
points
->
SetDataType
(
_points
.
depth
()
==
CV_32F
?
VTK_FLOAT
:
VTK_DOUBLE
);
points
->
SetNumberOfPoints
(
total
);
points
->
SetNumberOfPoints
(
(
vtkIdType
)
total
);
if
(
_points
.
depth
()
==
CV_32F
)
for
(
size_t
i
=
0
;
i
<
total
;
++
i
,
fpoints
+=
s_chs
)
points
->
SetPoint
(
i
,
fpoints
);
points
->
SetPoint
(
(
vtkIdType
)
i
,
fpoints
);
if
(
_points
.
depth
()
==
CV_64F
)
for
(
size_t
i
=
0
;
i
<
total
;
++
i
,
dpoints
+=
s_chs
)
points
->
SetPoint
(
i
,
dpoints
);
points
->
SetPoint
(
(
vtkIdType
)
i
,
dpoints
);
vtkSmartPointer
<
vtkCellArray
>
cell_array
=
vtkSmartPointer
<
vtkCellArray
>::
New
();
cell_array
->
Allocate
(
cell_array
->
EstimateSize
(
1
,
total
));
cell_array
->
InsertNextCell
(
total
);
cell_array
->
Allocate
(
cell_array
->
EstimateSize
(
1
,
(
int
)
total
));
cell_array
->
InsertNextCell
(
(
int
)
total
);
for
(
size_t
i
=
0
;
i
<
total
;
++
i
)
cell_array
->
InsertCellPoint
(
i
);
cell_array
->
InsertCellPoint
(
(
vtkIdType
)
i
);
vtkSmartPointer
<
vtkUnsignedCharArray
>
scalars
=
VtkUtils
::
FillScalars
(
total
,
color
);
...
...
modules/viz/src/vizcore.cpp
View file @
17fea0dd
...
...
@@ -278,11 +278,11 @@ void cv::viz::writeTrajectory(InputArray _traj, const String& files_format, int
if
(
traj
.
depth
()
==
CV_32F
)
for
(
size_t
i
=
0
,
index
=
max
(
0
,
start
);
i
<
traj
.
total
();
++
i
,
++
index
)
writePose
(
cv
::
format
(
files_format
.
c_str
(),
index
),
traj
.
at
<
Affine3f
>
(
i
),
tag
);
writePose
(
cv
::
format
(
files_format
.
c_str
(),
index
),
traj
.
at
<
Affine3f
>
(
(
int
)
i
),
tag
);
if
(
traj
.
depth
()
==
CV_64F
)
for
(
size_t
i
=
0
,
index
=
max
(
0
,
start
);
i
<
traj
.
total
();
++
i
,
++
index
)
writePose
(
cv
::
format
(
files_format
.
c_str
(),
index
),
traj
.
at
<
Affine3d
>
(
i
),
tag
);
writePose
(
cv
::
format
(
files_format
.
c_str
(),
index
),
traj
.
at
<
Affine3d
>
(
(
int
)
i
),
tag
);
}
CV_Assert
(
!
"Unsupported array kind"
);
...
...
modules/viz/src/vtk/vtkCloudMatSink.cpp
View file @
17fea0dd
...
...
@@ -79,11 +79,11 @@ void cv::viz::vtkCloudMatSink::WriteData()
if
(
cloud
.
depth
()
==
CV_32F
)
for
(
size_t
i
=
0
;
i
<
cloud
.
total
();
++
i
)
*
fdata
++
=
Vec3d
(
points_Data
->
GetPoint
(
i
));
*
fdata
++
=
Vec3d
(
points_Data
->
GetPoint
(
(
vtkIdType
)
i
));
if
(
cloud
.
depth
()
==
CV_64F
)
for
(
size_t
i
=
0
;
i
<
cloud
.
total
();
++
i
)
*
ddata
++
=
Vec3d
(
points_Data
->
GetPoint
(
i
));
*
ddata
++
=
Vec3d
(
points_Data
->
GetPoint
(
(
vtkIdType
)
i
));
}
else
cloud
.
release
();
...
...
@@ -101,7 +101,7 @@ void cv::viz::vtkCloudMatSink::WriteData()
Mat
buffer
(
cloud
.
size
(),
CV_64FC
(
channels
));
Vec3d
*
cptr
=
buffer
.
ptr
<
Vec3d
>
();
for
(
size_t
i
=
0
;
i
<
buffer
.
total
();
++
i
)
*
cptr
++
=
Vec3d
(
scalars_data
->
GetTuple
(
i
));
*
cptr
++
=
Vec3d
(
scalars_data
->
GetTuple
(
(
vtkIdType
)
i
));
buffer
.
convertTo
(
colors
,
CV_8U
,
vtktype
==
VTK_FLOAT
||
VTK_FLOAT
==
VTK_DOUBLE
?
255.0
:
1.0
);
}
...
...
@@ -121,7 +121,7 @@ void cv::viz::vtkCloudMatSink::WriteData()
Mat
buffer
(
cloud
.
size
(),
CV_64FC
(
channels
));
Vec3d
*
cptr
=
buffer
.
ptr
<
Vec3d
>
();
for
(
size_t
i
=
0
;
i
<
buffer
.
total
();
++
i
)
*
cptr
++
=
Vec3d
(
normals_data
->
GetTuple
(
i
));
*
cptr
++
=
Vec3d
(
normals_data
->
GetTuple
(
(
vtkIdType
)
i
));
buffer
.
convertTo
(
normals
,
vtktype
==
VTK_FLOAT
?
CV_32F
:
CV_64F
);
}
...
...
@@ -140,7 +140,7 @@ void cv::viz::vtkCloudMatSink::WriteData()
Mat
buffer
(
cloud
.
size
(),
CV_64FC2
);
Vec2d
*
cptr
=
buffer
.
ptr
<
Vec2d
>
();
for
(
size_t
i
=
0
;
i
<
buffer
.
total
();
++
i
)
*
cptr
++
=
Vec2d
(
coords_data
->
GetTuple
(
i
));
*
cptr
++
=
Vec2d
(
coords_data
->
GetTuple
(
(
vtkIdType
)
i
));
buffer
.
convertTo
(
tcoords
,
vtktype
==
VTK_FLOAT
?
CV_32F
:
CV_64F
);
...
...
modules/viz/src/vtk/vtkCloudMatSource.cpp
View file @
17fea0dd
...
...
@@ -185,8 +185,8 @@ int cv::viz::vtkCloudMatSource::filterNanCopy(const Mat& cloud)
CV_DbgAssert
(
DataType
<
_Tp
>::
depth
==
cloud
.
depth
());
points
=
vtkSmartPointer
<
vtkPoints
>::
New
();
points
->
SetDataType
(
VtkDepthTraits
<
_Tp
>::
data_type
);
points
->
Allocate
(
cloud
.
total
());
points
->
SetNumberOfPoints
(
cloud
.
total
());
points
->
Allocate
(
(
vtkIdType
)
cloud
.
total
());
points
->
SetNumberOfPoints
(
(
vtkIdType
)
cloud
.
total
());
int
s_chs
=
cloud
.
channels
();
int
total
=
0
;
...
...
modules/viz/src/vtk/vtkTrajectorySource.cpp
View file @
17fea0dd
...
...
@@ -64,19 +64,19 @@ void cv::viz::vtkTrajectorySource::SetTrajectory(InputArray _traj)
points
=
vtkSmartPointer
<
vtkPoints
>::
New
();
points
->
SetDataType
(
VTK_DOUBLE
);
points
->
SetNumberOfPoints
(
total
);
points
->
SetNumberOfPoints
(
(
vtkIdType
)
total
);
tensors
=
vtkSmartPointer
<
vtkDoubleArray
>::
New
();
tensors
->
SetNumberOfComponents
(
9
);
tensors
->
SetNumberOfTuples
(
total
);
tensors
->
SetNumberOfTuples
(
(
vtkIdType
)
total
);
for
(
size_t
i
=
0
;
i
<
total
;
++
i
,
++
dpath
)
{
Matx33d
R
=
dpath
->
rotation
().
t
();
// transposed because of
tensors
->
SetTuple
(
i
,
R
.
val
);
// column major order
tensors
->
SetTuple
(
(
vtkIdType
)
i
,
R
.
val
);
// column major order
Vec3d
p
=
dpath
->
translation
();
points
->
SetPoint
(
i
,
p
.
val
);
points
->
SetPoint
(
(
vtkIdType
)
i
,
p
.
val
);
}
}
...
...
@@ -85,7 +85,7 @@ cv::Mat cv::viz::vtkTrajectorySource::ExtractPoints(InputArray _traj)
CV_Assert
(
_traj
.
kind
()
==
_InputArray
::
STD_VECTOR
||
_traj
.
kind
()
==
_InputArray
::
MAT
);
CV_Assert
(
_traj
.
type
()
==
CV_32FC
(
16
)
||
_traj
.
type
()
==
CV_64FC
(
16
));
Mat
points
(
1
,
_traj
.
total
(),
CV_MAKETYPE
(
_traj
.
depth
(),
3
));
Mat
points
(
1
,
(
int
)
_traj
.
total
(),
CV_MAKETYPE
(
_traj
.
depth
(),
3
));
const
Affine3d
*
dpath
=
_traj
.
getMat
().
ptr
<
Affine3d
>
();
const
Affine3f
*
fpath
=
_traj
.
getMat
().
ptr
<
Affine3f
>
();
...
...
modules/viz/test/tests_simple.cpp
View file @
17fea0dd
...
...
@@ -81,7 +81,7 @@ TEST(Viz, show_cloud_masked)
Mat
dragon_cloud
=
readCloud
(
get_dragon_ply_file_path
());
Vec3f
qnan
=
Vec3f
::
all
(
std
::
numeric_limits
<
float
>::
quiet_NaN
());
for
(
size_t
i
=
0
;
i
<
dragon_cloud
.
total
();
++
i
)
for
(
int
i
=
0
;
i
<
(
int
)
dragon_cloud
.
total
();
++
i
)
if
(
i
%
15
!=
0
)
dragon_cloud
.
at
<
Vec3f
>
(
i
)
=
qnan
;
...
...
@@ -170,7 +170,7 @@ TEST(Viz, show_textured_mesh)
tcoords
.
push_back
(
Vec2d
(
1.0
,
i
/
64.0
));
}
for
(
size_t
i
=
0
;
i
<
points
.
size
()
/
2
-
1
;
++
i
)
for
(
int
i
=
0
;
i
<
(
int
)
points
.
size
()
/
2
-
1
;
++
i
)
{
int
polys
[]
=
{
3
,
2
*
i
,
2
*
i
+
1
,
2
*
i
+
2
,
3
,
2
*
i
+
1
,
2
*
i
+
2
,
2
*
i
+
3
};
polygons
.
insert
(
polygons
.
end
(),
polys
,
polys
+
sizeof
(
polys
)
/
sizeof
(
polys
[
0
]));
...
...
@@ -194,7 +194,7 @@ TEST(Viz, show_textured_mesh)
TEST
(
Viz
,
show_polyline
)
{
Mat
polyline
(
1
,
32
,
CV_64FC3
);
for
(
size_t
i
=
0
;
i
<
polyline
.
total
();
++
i
)
for
(
int
i
=
0
;
i
<
(
int
)
polyline
.
total
();
++
i
)
polyline
.
at
<
Vec3d
>
(
i
)
=
Vec3d
(
i
/
16.0
,
cos
(
i
*
CV_PI
/
6
),
sin
(
i
*
CV_PI
/
6
));
Viz3d
viz
(
"show_polyline"
);
...
...
@@ -222,13 +222,14 @@ TEST(Viz, show_sampled_normals)
TEST
(
Viz
,
show_trajectories
)
{
std
::
vector
<
Affine3d
>
path
=
generate_test_trajectory
<
double
>
(),
sub0
,
sub1
,
sub2
,
sub3
,
sub4
,
sub5
;
Mat
(
path
).
rowRange
(
0
,
path
.
size
()
/
10
+
1
).
copyTo
(
sub0
);
Mat
(
path
).
rowRange
(
path
.
size
()
/
10
,
path
.
size
()
/
5
+
1
).
copyTo
(
sub1
);
Mat
(
path
).
rowRange
(
path
.
size
()
/
5
,
11
*
path
.
size
()
/
12
).
copyTo
(
sub2
);
Mat
(
path
).
rowRange
(
11
*
path
.
size
()
/
12
,
path
.
size
()).
copyTo
(
sub3
);
Mat
(
path
).
rowRange
(
3
*
path
.
size
()
/
4
,
33
*
path
.
size
()
/
40
).
copyTo
(
sub4
);
Mat
(
path
).
rowRange
(
33
*
path
.
size
()
/
40
,
9
*
path
.
size
()
/
10
).
copyTo
(
sub5
);
int
size
=
(
int
)
path
.
size
();
Mat
(
path
).
rowRange
(
0
,
size
/
10
+
1
).
copyTo
(
sub0
);
Mat
(
path
).
rowRange
(
size
/
10
,
size
/
5
+
1
).
copyTo
(
sub1
);
Mat
(
path
).
rowRange
(
size
/
5
,
11
*
size
/
12
).
copyTo
(
sub2
);
Mat
(
path
).
rowRange
(
11
*
size
/
12
,
size
).
copyTo
(
sub3
);
Mat
(
path
).
rowRange
(
3
*
size
/
4
,
33
*
size
/
40
).
copyTo
(
sub4
);
Mat
(
path
).
rowRange
(
33
*
size
/
40
,
9
*
size
/
10
).
copyTo
(
sub5
);
Matx33d
K
(
1024.0
,
0.0
,
320.0
,
0.0
,
1024.0
,
240.0
,
0.0
,
0.0
,
1.0
);
Viz3d
viz
(
"show_trajectories"
);
...
...
@@ -259,7 +260,7 @@ TEST(Viz, show_trajectory_reposition)
Viz3d
viz
(
"show_trajectory_reposition_to_origin"
);
viz
.
showWidget
(
"coos"
,
WCoordinateSystem
());
viz
.
showWidget
(
"sub3"
,
WTrajectory
(
Mat
(
path
).
rowRange
(
0
,
path
.
size
()
/
3
),
WTrajectory
::
BOTH
,
0.2
,
Color
::
brown
()),
path
.
front
().
inv
());
viz
.
showWidget
(
"sub3"
,
WTrajectory
(
Mat
(
path
).
rowRange
(
0
,
(
int
)
path
.
size
()
/
3
),
WTrajectory
::
BOTH
,
0.2
,
Color
::
brown
()),
path
.
front
().
inv
());
viz
.
showWidget
(
"text2d"
,
WText
(
"Trajectory resposition to origin"
,
Point
(
20
,
20
),
20
,
Color
::
green
()));
viz
.
spin
();
}
...
...
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