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
93fe2f6e
Commit
93fe2f6e
authored
Jun 21, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
showPlane with color
parent
f94c2414
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
15 deletions
+21
-15
viz3d.hpp
modules/viz/include/opencv2/viz/viz3d.hpp
+2
-2
viz3d_impl.hpp
modules/viz/src/q/viz3d_impl.hpp
+2
-2
viz3d.cpp
modules/viz/src/viz3d.cpp
+4
-4
viz3d_impl.cpp
modules/viz/src/viz3d_impl.cpp
+12
-4
test_viz3d.cpp
modules/viz/test/test_viz3d.cpp
+1
-3
No files found.
modules/viz/include/opencv2/viz/viz3d.hpp
View file @
93fe2f6e
...
@@ -33,8 +33,8 @@ namespace temp_viz
...
@@ -33,8 +33,8 @@ 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
);
void
showPlane
(
const
String
&
id
,
const
Vec4f
&
coefs
);
void
showPlane
(
const
String
&
id
,
const
Vec4f
&
coefs
,
const
Color
&
color
);
void
showPlane
(
const
String
&
id
,
const
Vec4f
&
coefs
,
const
Point3f
&
pt
);
void
showPlane
(
const
String
&
id
,
const
Vec4f
&
coefs
,
const
Point3f
&
pt
,
const
Color
&
color
);
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 @
93fe2f6e
...
@@ -139,8 +139,8 @@ public:
...
@@ -139,8 +139,8 @@ public:
}
}
void
showLine
(
const
String
&
id
,
const
cv
::
Point3f
&
pt1
,
const
cv
::
Point3f
&
pt2
,
const
Color
&
color
);
void
showLine
(
const
String
&
id
,
const
cv
::
Point3f
&
pt1
,
const
cv
::
Point3f
&
pt2
,
const
Color
&
color
);
void
showPlane
(
const
String
&
id
,
const
cv
::
Vec4f
&
coefs
);
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
);
void
showPlane
(
const
String
&
id
,
const
cv
::
Vec4f
&
coefs
,
const
cv
::
Point3f
&
pt
,
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 @
93fe2f6e
...
@@ -83,14 +83,14 @@ void temp_viz::Viz3d::showLine(const String &id, const Point3f &pt1, const Point
...
@@ -83,14 +83,14 @@ void temp_viz::Viz3d::showLine(const String &id, const Point3f &pt1, const Point
impl_
->
showLine
(
id
,
pt1
,
pt2
,
color
);
impl_
->
showLine
(
id
,
pt1
,
pt2
,
color
);
}
}
void
temp_viz
::
Viz3d
::
showPlane
(
const
String
&
id
,
const
Vec4f
&
coefs
)
void
temp_viz
::
Viz3d
::
showPlane
(
const
String
&
id
,
const
Vec4f
&
coefs
,
const
Color
&
color
)
{
{
impl_
->
showPlane
(
id
,
coefs
);
impl_
->
showPlane
(
id
,
coefs
,
color
);
}
}
void
temp_viz
::
Viz3d
::
showPlane
(
const
String
&
id
,
const
Vec4f
&
coefs
,
const
Point3f
&
pt
)
void
temp_viz
::
Viz3d
::
showPlane
(
const
String
&
id
,
const
Vec4f
&
coefs
,
const
Point3f
&
pt
,
const
Color
&
color
)
{
{
impl_
->
showPlane
(
id
,
coefs
,
pt
);
impl_
->
showPlane
(
id
,
coefs
,
pt
,
color
);
}
}
bool
temp_viz
::
Viz3d
::
removeCoordinateSystem
(
const
String
&
id
)
bool
temp_viz
::
Viz3d
::
removeCoordinateSystem
(
const
String
&
id
)
...
...
modules/viz/src/viz3d_impl.cpp
View file @
93fe2f6e
...
@@ -302,17 +302,19 @@ void temp_viz::Viz3d::VizImpl::showLine (const String &id, const cv::Point3f &pt
...
@@ -302,17 +302,19 @@ void temp_viz::Viz3d::VizImpl::showLine (const String &id, const cv::Point3f &pt
}
}
}
}
void
temp_viz
::
Viz3d
::
VizImpl
::
showPlane
(
const
String
&
id
,
const
cv
::
Vec4f
&
coefs
)
void
temp_viz
::
Viz3d
::
VizImpl
::
showPlane
(
const
String
&
id
,
const
cv
::
Vec4f
&
coefs
,
const
Color
&
color
)
{
{
// Check if this Id already exists
// Check if this Id already exists
ShapeActorMap
::
iterator
am_it
=
shape_actor_map_
->
find
(
id
);
ShapeActorMap
::
iterator
am_it
=
shape_actor_map_
->
find
(
id
);
bool
exists
=
(
am_it
!=
shape_actor_map_
->
end
());
bool
exists
=
(
am_it
!=
shape_actor_map_
->
end
());
Color
c
=
vtkcolor
(
color
);
// If it exists just update
// If it exists just update
if
(
exists
)
if
(
exists
)
{
{
vtkSmartPointer
<
vtkLODActor
>
actor
=
vtkLODActor
::
SafeDownCast
(
am_it
->
second
);
vtkSmartPointer
<
vtkLODActor
>
actor
=
vtkLODActor
::
SafeDownCast
(
am_it
->
second
);
reinterpret_cast
<
vtkDataSetMapper
*>
(
actor
->
GetMapper
())
->
SetInput
(
createPlane
(
coefs
));
reinterpret_cast
<
vtkDataSetMapper
*>
(
actor
->
GetMapper
())
->
SetInput
(
createPlane
(
coefs
));
actor
->
GetProperty
()
->
SetColor
(
c
.
val
);
actor
->
GetMapper
()
->
ScalarVisibilityOff
();
actor
->
Modified
();
actor
->
Modified
();
}
}
else
else
...
@@ -326,6 +328,8 @@ void temp_viz::Viz3d::VizImpl::showPlane (const String &id, const cv::Vec4f &coe
...
@@ -326,6 +328,8 @@ void temp_viz::Viz3d::VizImpl::showPlane (const String &id, const cv::Vec4f &coe
// actor->GetProperty ()->SetRepresentationToWireframe ();
// actor->GetProperty ()->SetRepresentationToWireframe ();
actor
->
GetProperty
()
->
SetRepresentationToSurface
();
actor
->
GetProperty
()
->
SetRepresentationToSurface
();
actor
->
GetProperty
()
->
SetLighting
(
false
);
actor
->
GetProperty
()
->
SetLighting
(
false
);
actor
->
GetProperty
()
->
SetColor
(
c
.
val
);
actor
->
GetMapper
()
->
ScalarVisibilityOff
();
renderer_
->
AddActor
(
actor
);
renderer_
->
AddActor
(
actor
);
// Save the pointer/ID pair to the global actor map
// Save the pointer/ID pair to the global actor map
...
@@ -333,17 +337,19 @@ void temp_viz::Viz3d::VizImpl::showPlane (const String &id, const cv::Vec4f &coe
...
@@ -333,17 +337,19 @@ void temp_viz::Viz3d::VizImpl::showPlane (const String &id, const cv::Vec4f &coe
}
}
}
}
void
temp_viz
::
Viz3d
::
VizImpl
::
showPlane
(
const
String
&
id
,
const
cv
::
Vec4f
&
coefs
,
const
cv
::
Point3f
&
pt
)
void
temp_viz
::
Viz3d
::
VizImpl
::
showPlane
(
const
String
&
id
,
const
cv
::
Vec4f
&
coefs
,
const
cv
::
Point3f
&
pt
,
const
Color
&
color
)
{
{
// Check if this Id already exists
// Check if this Id already exists
ShapeActorMap
::
iterator
am_it
=
shape_actor_map_
->
find
(
id
);
ShapeActorMap
::
iterator
am_it
=
shape_actor_map_
->
find
(
id
);
bool
exists
=
(
am_it
!=
shape_actor_map_
->
end
());
bool
exists
=
(
am_it
!=
shape_actor_map_
->
end
());
Color
c
=
vtkcolor
(
color
);
// If it exists just update
// If it exists just update
if
(
exists
)
if
(
exists
)
{
{
vtkSmartPointer
<
vtkLODActor
>
actor
=
vtkLODActor
::
SafeDownCast
(
am_it
->
second
);
vtkSmartPointer
<
vtkLODActor
>
actor
=
vtkLODActor
::
SafeDownCast
(
am_it
->
second
);
reinterpret_cast
<
vtkDataSetMapper
*>
(
actor
->
GetMapper
())
->
SetInput
(
createPlane
(
coefs
,
pt
));
reinterpret_cast
<
vtkDataSetMapper
*>
(
actor
->
GetMapper
())
->
SetInput
(
createPlane
(
coefs
,
pt
));
actor
->
GetProperty
()
->
SetColor
(
c
.
val
);
actor
->
GetMapper
()
->
ScalarVisibilityOff
();
actor
->
Modified
();
actor
->
Modified
();
}
}
else
else
...
@@ -357,6 +363,8 @@ void temp_viz::Viz3d::VizImpl::showPlane (const String &id ,const cv::Vec4f &coe
...
@@ -357,6 +363,8 @@ void temp_viz::Viz3d::VizImpl::showPlane (const String &id ,const cv::Vec4f &coe
// actor->GetProperty ()->SetRepresentationToWireframe ();
// actor->GetProperty ()->SetRepresentationToWireframe ();
actor
->
GetProperty
()
->
SetRepresentationToSurface
();
actor
->
GetProperty
()
->
SetRepresentationToSurface
();
actor
->
GetProperty
()
->
SetLighting
(
false
);
actor
->
GetProperty
()
->
SetLighting
(
false
);
actor
->
GetProperty
()
->
SetColor
(
c
.
val
);
actor
->
GetMapper
()
->
ScalarVisibilityOff
();
renderer_
->
AddActor
(
actor
);
renderer_
->
AddActor
(
actor
);
// Save the pointer/ID pair to the global actor map
// Save the pointer/ID pair to the global actor map
...
...
modules/viz/test/test_viz3d.cpp
View file @
93fe2f6e
...
@@ -93,8 +93,6 @@ TEST(Viz_viz3d, accuracy)
...
@@ -93,8 +93,6 @@ TEST(Viz_viz3d, accuracy)
int
col_green
=
0
;
int
col_green
=
0
;
int
col_red
=
0
;
int
col_red
=
0
;
v
.
showPlane
(
"plane1"
,
cv
::
Vec4f
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
));
while
(
!
v
.
wasStopped
())
while
(
!
v
.
wasStopped
())
{
{
// Creating new point cloud with id cloud1
// Creating new point cloud with id cloud1
...
@@ -104,7 +102,7 @@ TEST(Viz_viz3d, accuracy)
...
@@ -104,7 +102,7 @@ TEST(Viz_viz3d, accuracy)
v
.
showLine
(
"line2"
,
cv
::
Point3f
(
0.0
,
0.0
,
0.0
),
cv
::
Point3f
(
1.0
f
-
pos_x
,
pos_y
,
pos_z
)
,
temp_viz
::
Color
(
255
-
col_blue
,
255
-
col_green
,
255
-
col_red
));
v
.
showLine
(
"line2"
,
cv
::
Point3f
(
0.0
,
0.0
,
0.0
),
cv
::
Point3f
(
1.0
f
-
pos_x
,
pos_y
,
pos_z
)
,
temp_viz
::
Color
(
255
-
col_blue
,
255
-
col_green
,
255
-
col_red
));
v
.
showLine
(
"line3"
,
cv
::
Point3f
(
0.0
,
0.0
,
0.0
),
cv
::
Point3f
(
pos_x
,
1.0
f
-
pos_y
,
pos_z
)
,
temp_viz
::
Color
(
255
-
col_blue
,
255
-
col_green
,
255
-
col_red
));
v
.
showLine
(
"line3"
,
cv
::
Point3f
(
0.0
,
0.0
,
0.0
),
cv
::
Point3f
(
pos_x
,
1.0
f
-
pos_y
,
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
.
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
));
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
)
);
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