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
6e5ae985
Commit
6e5ae985
authored
Jul 08, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial cloud widget implementation, fix safedowncasts
parent
d394e233
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
11 deletions
+25
-11
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+7
-0
simple_widgets.cpp
modules/viz/src/simple_widgets.cpp
+0
-0
viz3d_impl.cpp
modules/viz/src/viz3d_impl.cpp
+1
-1
widget.cpp
modules/viz/src/widget.cpp
+4
-4
test_viz3d.cpp
modules/viz/test/test_viz3d.cpp
+13
-6
No files found.
modules/viz/include/opencv2/viz/widgets.hpp
View file @
6e5ae985
...
...
@@ -97,4 +97,11 @@ namespace temp_viz
// TODO Overload setColor method, and hide setPose, updatePose, getPose methods
};
class
CV_EXPORTS
CloudWidget
:
public
Widget
{
public
:
CloudWidget
(
InputArray
_cloud
,
InputArray
_colors
);
CloudWidget
(
InputArray
_cloud
,
const
Color
&
color
=
Color
::
white
());
};
}
modules/viz/src/simple_widgets.cpp
View file @
6e5ae985
This diff is collapsed.
Click to expand it.
modules/viz/src/viz3d_impl.cpp
View file @
6e5ae985
...
...
@@ -874,7 +874,7 @@ void temp_viz::Viz3d::VizImpl::showWidget(const String &id, const Widget &widget
removeActorFromRenderer
(
wam_itr
->
second
.
actor
);
}
// Get the actor and set the user matrix
vtk
SmartPointer
<
vtkLODActor
>
actor
;
vtk
LODActor
*
actor
;
if
(
actor
=
vtkLODActor
::
SafeDownCast
(
WidgetAccessor
::
getActor
(
widget
)))
{
vtkSmartPointer
<
vtkMatrix4x4
>
matrix
=
convertToVtkMatrix
(
pose
.
matrix
);
...
...
modules/viz/src/widget.cpp
View file @
6e5ae985
...
...
@@ -18,7 +18,7 @@ public:
void
setColor
(
const
Color
&
color
)
{
vtk
SmartPointer
<
vtkLODActor
>
lod_actor
=
vtkLODActor
::
SafeDownCast
(
actor
);
vtk
LODActor
*
lod_actor
=
vtkLODActor
::
SafeDownCast
(
actor
);
Color
c
=
vtkcolor
(
color
);
lod_actor
->
GetMapper
()
->
ScalarVisibilityOff
();
lod_actor
->
GetProperty
()
->
SetColor
(
c
.
val
);
...
...
@@ -32,7 +32,7 @@ public:
void
setPose
(
const
Affine3f
&
pose
)
{
vtk
SmartPointer
<
vtkLODActor
>
lod_actor
=
vtkLODActor
::
SafeDownCast
(
actor
);
vtk
LODActor
*
lod_actor
=
vtkLODActor
::
SafeDownCast
(
actor
);
vtkSmartPointer
<
vtkMatrix4x4
>
matrix
=
convertToVtkMatrix
(
pose
.
matrix
);
lod_actor
->
SetUserMatrix
(
matrix
);
lod_actor
->
Modified
();
...
...
@@ -40,7 +40,7 @@ public:
void
updatePose
(
const
Affine3f
&
pose
)
{
vtk
SmartPointer
<
vtkLODActor
>
lod_actor
=
vtkLODActor
::
SafeDownCast
(
actor
);
vtk
LODActor
*
lod_actor
=
vtkLODActor
::
SafeDownCast
(
actor
);
vtkSmartPointer
<
vtkMatrix4x4
>
matrix
=
lod_actor
->
GetUserMatrix
();
if
(
!
matrix
)
{
...
...
@@ -58,7 +58,7 @@ public:
Affine3f
getPose
()
const
{
vtk
SmartPointer
<
vtkLODActor
>
lod_actor
=
vtkLODActor
::
SafeDownCast
(
actor
);
vtk
LODActor
*
lod_actor
=
vtkLODActor
::
SafeDownCast
(
actor
);
vtkSmartPointer
<
vtkMatrix4x4
>
matrix
=
lod_actor
->
GetUserMatrix
();
Matx44f
matrix_cv
=
convertToMatx
(
matrix
);
return
Affine3f
(
matrix_cv
);
...
...
modules/viz/test/test_viz3d.cpp
View file @
6e5ae985
...
...
@@ -53,7 +53,7 @@
cv
::
Mat
cvcloud_load
()
{
cv
::
Mat
cloud
(
1
,
20000
,
CV_32FC3
);
std
::
ifstream
ifs
(
"
d:/
cloud_dragon.ply"
);
std
::
ifstream
ifs
(
"cloud_dragon.ply"
);
std
::
string
str
;
for
(
size_t
i
=
0
;
i
<
11
;
++
i
)
...
...
@@ -99,23 +99,29 @@ TEST(Viz_viz3d, accuracy)
temp_viz
::
CubeWidget
cuw
(
cv
::
Point3f
(
-
2
,
-
2
,
-
2
),
cv
::
Point3f
(
-
1
,
-
1
,
-
1
));
temp_viz
::
CoordinateSystemWidget
csw
(
1.0
f
,
cv
::
Affine3f
::
Identity
());
temp_viz
::
TextWidget
tw
(
"TEST"
,
cv
::
Point2i
(
100
,
100
),
20
);
temp_viz
::
CloudWidget
pcw
(
cloud
,
colors
);
temp_viz
::
CloudWidget
pcw2
(
cloud
,
temp_viz
::
Color
(
255
,
255
,
255
));
// v.showWidget("line", lw);
v
.
showWidget
(
"plane"
,
pw
);
//
v.showWidget("plane", pw);
// v.showWidget("sphere", sw);
// v.showWidget("arrow", aw);
// v.showWidget("circle", cw);
// v.showWidget("cylinder", cyw);
v
.
showWidget
(
"cube"
,
cuw
);
//
v.showWidget("cube", cuw);
v
.
showWidget
(
"coordinateSystem"
,
csw
);
v
.
showWidget
(
"text"
,
tw
);
// v.showWidget("text",tw);
v
.
showWidget
(
"pcw"
,
pcw
);
v
.
showWidget
(
"pcw2"
,
pcw2
);
temp_viz
::
LineWidget
lw2
=
lw
;
// v.showPointCloud("cld",cloud, colors);
while
(
!
v
.
wasStopped
())
{
// Creating new point cloud with id cloud1
cv
::
Affine3f
cloudPosition
(
angle_x
,
angle_y
,
angle_z
,
cv
::
Vec3f
(
pos_x
,
pos_y
,
pos_z
));
cv
::
Affine3f
cloudPosition2
(
angle_x
,
angle_y
,
angle_z
,
cv
::
Vec3f
(
pos_x
+
0.2
,
pos_y
+
0.2
,
pos_z
+
0.2
));
lw2
.
setColor
(
temp_viz
::
Color
(
col_blue
,
col_green
,
col_red
));
lw
.
setLineWidth
(
lw
.
getLineWidth
()
+
pos_x
*
10
);
...
...
@@ -129,8 +135,9 @@ TEST(Viz_viz3d, accuracy)
cyw
.
setPose
(
cloudPosition
);
lw
.
setPose
(
cloudPosition
);
cuw
.
setPose
(
cloudPosition
);
v
.
showWidget
(
"plane"
,
pw
,
cloudPosition
);
v
.
showWidget
(
"pcw"
,
pcw
,
cloudPosition
);
v
.
showWidget
(
"pcw2"
,
pcw2
,
cloudPosition2
);
// v.showWidget("plane", pw, cloudPosition);
angle_x
+=
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