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
98edabd4
Commit
98edabd4
authored
Jun 26, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
showCylinder implementation
parent
55683e7b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
4 deletions
+47
-4
viz3d.hpp
modules/viz/include/opencv2/viz/viz3d.hpp
+5
-4
viz3d_impl.hpp
modules/viz/src/q/viz3d_impl.hpp
+1
-0
viz3d.cpp
modules/viz/src/viz3d.cpp
+5
-0
viz3d_impl.cpp
modules/viz/src/viz3d_impl.cpp
+34
-0
test_viz3d.cpp
modules/viz/test/test_viz3d.cpp
+2
-0
No files found.
modules/viz/include/opencv2/viz/viz3d.hpp
View file @
98edabd4
...
@@ -32,10 +32,11 @@ namespace temp_viz
...
@@ -32,10 +32,11 @@ namespace temp_viz
bool
addPointCloudNormals
(
const
Mat
&
cloud
,
const
Mat
&
normals
,
int
level
=
100
,
float
scale
=
0.02
f
,
const
String
&
id
=
"cloud"
);
bool
addPointCloudNormals
(
const
Mat
&
cloud
,
const
Mat
&
normals
,
int
level
=
100
,
float
scale
=
0.02
f
,
const
String
&
id
=
"cloud"
);
void
showLine
(
const
String
&
id
,
const
Point3f
&
pt1
,
const
Point3f
&
pt2
,
const
Color
&
color
);
void
showLine
(
const
String
&
id
,
const
Point3f
&
pt1
,
const
Point3f
&
pt2
,
const
Color
&
color
=
Color
(
255
,
255
,
255
));
void
showPlane
(
const
String
&
id
,
const
Vec4f
&
coefs
,
const
Color
&
color
);
void
showPlane
(
const
String
&
id
,
const
Vec4f
&
coefs
,
const
Color
&
color
=
Color
(
255
,
255
,
255
));
void
showPlane
(
const
String
&
id
,
const
Vec4f
&
coefs
,
const
Point3f
&
pt
,
const
Color
&
color
);
void
showPlane
(
const
String
&
id
,
const
Vec4f
&
coefs
,
const
Point3f
&
pt
,
const
Color
&
color
=
Color
(
255
,
255
,
255
));
void
showCube
(
const
String
&
id
,
const
Point3f
&
pt1
,
const
Point3f
&
pt2
,
const
Color
&
color
);
void
showCube
(
const
String
&
id
,
const
Point3f
&
pt1
,
const
Point3f
&
pt2
,
const
Color
&
color
=
Color
(
255
,
255
,
255
));
void
showCylinder
(
const
String
&
id
,
const
Point3f
&
pt_on_axis
,
const
Point3f
&
axis_direction
,
double
radius
,
int
num_sides
,
const
Color
&
color
=
Color
(
255
,
255
,
255
));
bool
addPlane
(
const
ModelCoefficients
&
coefficients
,
const
String
&
id
=
"plane"
);
bool
addPlane
(
const
ModelCoefficients
&
coefficients
,
const
String
&
id
=
"plane"
);
bool
addPlane
(
const
ModelCoefficients
&
coefficients
,
double
x
,
double
y
,
double
z
,
const
String
&
id
=
"plane"
);
bool
addPlane
(
const
ModelCoefficients
&
coefficients
,
double
x
,
double
y
,
double
z
,
const
String
&
id
=
"plane"
);
...
...
modules/viz/src/q/viz3d_impl.hpp
View file @
98edabd4
...
@@ -142,6 +142,7 @@ public:
...
@@ -142,6 +142,7 @@ public:
void
showPlane
(
const
String
&
id
,
const
cv
::
Vec4f
&
coefs
,
const
Color
&
color
);
void
showPlane
(
const
String
&
id
,
const
cv
::
Vec4f
&
coefs
,
const
Color
&
color
);
void
showPlane
(
const
String
&
id
,
const
cv
::
Vec4f
&
coefs
,
const
cv
::
Point3f
&
pt
,
const
Color
&
color
);
void
showPlane
(
const
String
&
id
,
const
cv
::
Vec4f
&
coefs
,
const
cv
::
Point3f
&
pt
,
const
Color
&
color
);
void
showCube
(
const
String
&
id
,
const
Point3f
&
pt1
,
const
Point3f
&
pt2
,
const
Color
&
color
);
void
showCube
(
const
String
&
id
,
const
Point3f
&
pt1
,
const
Point3f
&
pt2
,
const
Color
&
color
);
void
showCylinder
(
const
String
&
id
,
const
Point3f
&
pt_on_axis
,
const
Point3f
&
axis_direction
,
double
radius
,
int
num_sides
,
const
Color
&
color
);
bool
addPolygon
(
const
cv
::
Mat
&
cloud
,
const
Color
&
color
,
const
std
::
string
&
id
=
"polygon"
);
bool
addPolygon
(
const
cv
::
Mat
&
cloud
,
const
Color
&
color
,
const
std
::
string
&
id
=
"polygon"
);
bool
addArrow
(
const
cv
::
Point3f
&
pt1
,
const
cv
::
Point3f
&
pt2
,
const
Color
&
color
,
bool
display_length
,
const
std
::
string
&
id
=
"arrow"
);
bool
addArrow
(
const
cv
::
Point3f
&
pt1
,
const
cv
::
Point3f
&
pt2
,
const
Color
&
color
,
bool
display_length
,
const
std
::
string
&
id
=
"arrow"
);
...
...
modules/viz/src/viz3d.cpp
View file @
98edabd4
...
@@ -98,6 +98,11 @@ void temp_viz::Viz3d::showCube(const String &id, const Point3f &pt1, const Point
...
@@ -98,6 +98,11 @@ void temp_viz::Viz3d::showCube(const String &id, const Point3f &pt1, const Point
impl_
->
showCube
(
id
,
pt1
,
pt2
,
color
);
impl_
->
showCube
(
id
,
pt1
,
pt2
,
color
);
}
}
void
temp_viz
::
Viz3d
::
showCylinder
(
const
String
&
id
,
const
Point3f
&
pt_on_axis
,
const
Point3f
&
axis_direction
,
double
radius
,
int
num_sides
,
const
Color
&
color
)
{
impl_
->
showCylinder
(
id
,
pt_on_axis
,
axis_direction
,
radius
,
num_sides
,
color
);
}
bool
temp_viz
::
Viz3d
::
removeCoordinateSystem
(
const
String
&
id
)
bool
temp_viz
::
Viz3d
::
removeCoordinateSystem
(
const
String
&
id
)
{
{
return
impl_
->
removeCoordinateSystem
(
id
);
return
impl_
->
removeCoordinateSystem
(
id
);
...
...
modules/viz/src/viz3d_impl.cpp
View file @
98edabd4
...
@@ -407,6 +407,40 @@ void temp_viz::Viz3d::VizImpl::showCube (const String &id, const Point3f &pt1, c
...
@@ -407,6 +407,40 @@ void temp_viz::Viz3d::VizImpl::showCube (const String &id, const Point3f &pt1, c
}
}
}
}
void
temp_viz
::
Viz3d
::
VizImpl
::
showCylinder
(
const
String
&
id
,
const
Point3f
&
pt_on_axis
,
const
Point3f
&
axis_direction
,
double
radius
,
int
num_sides
,
const
Color
&
color
)
{
// Check if this Id already exists
ShapeActorMap
::
iterator
am_it
=
shape_actor_map_
->
find
(
id
);
bool
exists
=
(
am_it
!=
shape_actor_map_
->
end
());
Color
c
=
vtkcolor
(
color
);
// If it exists just update
if
(
exists
)
{
vtkSmartPointer
<
vtkLODActor
>
actor
=
vtkLODActor
::
SafeDownCast
(
am_it
->
second
);
reinterpret_cast
<
vtkDataSetMapper
*>
(
actor
->
GetMapper
())
->
SetInput
(
createCylinder
(
pt_on_axis
,
axis_direction
,
radius
,
num_sides
));
actor
->
GetProperty
()
->
SetColor
(
c
.
val
);
actor
->
GetMapper
()
->
ScalarVisibilityOff
();
actor
->
Modified
();
}
else
{
// Create a plane
vtkSmartPointer
<
vtkDataSet
>
data
=
createCylinder
(
pt_on_axis
,
axis_direction
,
radius
,
num_sides
);
// Create an Actor
vtkSmartPointer
<
vtkLODActor
>
actor
;
createActorFromVTKDataSet
(
data
,
actor
);
// actor->GetProperty ()->SetRepresentationToWireframe ();
actor
->
GetProperty
()
->
SetRepresentationToSurface
();
actor
->
GetProperty
()
->
SetLighting
(
false
);
actor
->
GetProperty
()
->
SetColor
(
c
.
val
);
actor
->
GetMapper
()
->
ScalarVisibilityOff
();
renderer_
->
AddActor
(
actor
);
// Save the pointer/ID pair to the global actor map
(
*
shape_actor_map_
)[
id
]
=
actor
;
}
}
bool
temp_viz
::
Viz3d
::
VizImpl
::
addPolygonMesh
(
const
Mesh3d
&
mesh
,
const
Mat
&
mask
,
const
std
::
string
&
id
)
bool
temp_viz
::
Viz3d
::
VizImpl
::
addPolygonMesh
(
const
Mesh3d
&
mesh
,
const
Mat
&
mask
,
const
std
::
string
&
id
)
{
{
...
...
modules/viz/test/test_viz3d.cpp
View file @
98edabd4
...
@@ -104,6 +104,8 @@ TEST(Viz_viz3d, accuracy)
...
@@ -104,6 +104,8 @@ TEST(Viz_viz3d, accuracy)
v
.
showLine
(
"line4"
,
cv
::
Point3f
(
0.0
,
0.0
,
0.0
),
cv
::
Point3f
(
pos_x
,
pos_y
,
1.0
f
-
pos_z
)
,
temp_viz
::
Color
(
255
-
col_blue
,
255
-
col_green
,
255
-
col_red
));
v
.
showLine
(
"line4"
,
cv
::
Point3f
(
0.0
,
0.0
,
0.0
),
cv
::
Point3f
(
pos_x
,
pos_y
,
1.0
f
-
pos_z
)
,
temp_viz
::
Color
(
255
-
col_blue
,
255
-
col_green
,
255
-
col_red
));
v
.
showPlane
(
"plane1"
,
cv
::
Vec4f
(
pos_x
*
pos_y
,
pos_y
,
pos_z
,
pos_x
+
pos_y
*
pos_z
),
temp_viz
::
Color
(
255
-
col_blue
,
255
-
col_green
,
255
-
col_red
));
v
.
showPlane
(
"plane1"
,
cv
::
Vec4f
(
pos_x
*
pos_y
,
pos_y
,
pos_z
,
pos_x
+
pos_y
*
pos_z
),
temp_viz
::
Color
(
255
-
col_blue
,
255
-
col_green
,
255
-
col_red
));
v
.
showCube
(
"cube1"
,
cv
::
Point3f
(
pos_x
,
pos_y
,
pos_z
),
cv
::
Point3f
(
pos_x
+
0.5
,
pos_y
+
0.5
,
pos_z
+
0.5
),
temp_viz
::
Color
(
255
,
150
,
50
));
v
.
showCube
(
"cube1"
,
cv
::
Point3f
(
pos_x
,
pos_y
,
pos_z
),
cv
::
Point3f
(
pos_x
+
0.5
,
pos_y
+
0.5
,
pos_z
+
0.5
),
temp_viz
::
Color
(
255
,
150
,
50
));
v
.
showCylinder
(
"cylinder1"
,
cv
::
Point3f
(
0
,
0
,
0
),
cv
::
Point3f
(
pos_x
,
1.0
,
1.0
),
0.5
,
5
*
pos_x
+
3
,
temp_viz
::
Color
(
0
,
255
,
0
));
angle_x
+=
0.1
f
;
angle_x
+=
0.1
f
;
angle_y
-=
0.1
f
;
angle_y
-=
0.1
f
;
...
...
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