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
e1859002
Commit
e1859002
authored
Jul 10, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grid widget implementation
parent
71c76aec
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
4 deletions
+50
-4
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+7
-0
simple_widgets.cpp
modules/viz/src/simple_widgets.cpp
+32
-0
test_viz3d.cpp
modules/viz/test/test_viz3d.cpp
+11
-4
No files found.
modules/viz/include/opencv2/viz/widgets.hpp
View file @
e1859002
...
...
@@ -115,6 +115,12 @@ namespace temp_viz
struct
CopyImpl
;
};
class
CV_EXPORTS
GridWidget
:
public
Widget3D
{
public
:
GridWidget
(
Vec2i
dimensions
,
Vec2d
spacing
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
TextWidget
:
public
Widget2D
{
public
:
...
...
@@ -154,6 +160,7 @@ namespace temp_viz
template
<>
CV_EXPORTS
CubeWidget
Widget
::
cast
<
CubeWidget
>
();
template
<>
CV_EXPORTS
CoordinateSystemWidget
Widget
::
cast
<
CoordinateSystemWidget
>
();
template
<>
CV_EXPORTS
PolyLineWidget
Widget
::
cast
<
PolyLineWidget
>
();
template
<>
CV_EXPORTS
GridWidget
Widget
::
cast
<
GridWidget
>
();
template
<>
CV_EXPORTS
TextWidget
Widget
::
cast
<
TextWidget
>
();
template
<>
CV_EXPORTS
CloudWidget
Widget
::
cast
<
CloudWidget
>
();
template
<>
CV_EXPORTS
CloudNormalsWidget
Widget
::
cast
<
CloudNormalsWidget
>
();
...
...
modules/viz/src/simple_widgets.cpp
View file @
e1859002
...
...
@@ -418,6 +418,38 @@ template<> temp_viz::PolyLineWidget temp_viz::Widget::cast<temp_viz::PolyLineWid
return
static_cast
<
PolyLineWidget
&>
(
widget
);
}
///////////////////////////////////////////////////////////////////////////////////////////////
/// grid widget implementation
temp_viz
::
GridWidget
::
GridWidget
(
Vec2i
dimensions
,
Vec2d
spacing
,
const
Color
&
color
)
{
// Create the grid using image data
vtkSmartPointer
<
vtkImageData
>
grid
=
vtkSmartPointer
<
vtkImageData
>::
New
();
// Add 1 to dimensions because in ImageData dimensions is the number of lines
// - however here it means number of cells
grid
->
SetDimensions
(
dimensions
[
0
]
+
1
,
dimensions
[
1
]
+
1
,
1
);
grid
->
SetSpacing
(
spacing
[
0
],
spacing
[
1
],
0.
);
// Set origin of the grid to be the middle of the grid
grid
->
SetOrigin
(
dimensions
[
0
]
*
spacing
[
0
]
*
(
-
0.5
),
dimensions
[
1
]
*
spacing
[
1
]
*
(
-
0.5
),
0
);
vtkSmartPointer
<
vtkDataSetMapper
>
mapper
=
vtkSmartPointer
<
vtkDataSetMapper
>::
New
();
mapper
->
SetInput
(
grid
);
vtkSmartPointer
<
vtkActor
>
actor
=
vtkSmartPointer
<
vtkActor
>::
New
();
actor
->
SetMapper
(
mapper
);
// Show it as wireframe
actor
->
GetProperty
()
->
SetRepresentationToWireframe
();
WidgetAccessor
::
setProp
(
*
this
,
actor
);
}
template
<>
temp_viz
::
GridWidget
temp_viz
::
Widget
::
cast
<
temp_viz
::
GridWidget
>
()
{
Widget3D
widget
=
this
->
cast
<
Widget3D
>
();
return
static_cast
<
GridWidget
&>
(
widget
);
}
///////////////////////////////////////////////////////////////////////////////////////////////
/// text widget implementation
...
...
modules/viz/test/test_viz3d.cpp
View file @
e1859002
...
...
@@ -136,8 +136,13 @@ TEST(Viz_viz3d, accuracy)
points
=
points
.
reshape
(
0
,
2
);
temp_viz
::
PolyLineWidget
plw
(
points
);
v
.
showWidget
(
"polyline"
,
plw
);
lw
=
v
.
getWidget
(
"polyline"
).
cast
<
temp_viz
::
LineWidget
>
();
// v.showWidget("polyline",plw);
// lw = v.getWidget("polyline").cast<temp_viz::LineWidget>();
temp_viz
::
GridWidget
gw
(
temp_viz
::
Vec2i
(
10
,
10
),
temp_viz
::
Vec2d
(
0.1
,
0.1
));
v
.
showWidget
(
"grid"
,
gw
);
lw
=
v
.
getWidget
(
"grid"
).
cast
<
temp_viz
::
LineWidget
>
();
// float grid_x_angle = 0.0;
while
(
!
v
.
wasStopped
())
{
...
...
@@ -145,8 +150,8 @@ TEST(Viz_viz3d, accuracy)
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
(
pos_x
*
10
);
lw
.
setColor
(
temp_viz
::
Color
(
col_blue
,
col_green
,
col_red
));
//
lw.setLineWidth(pos_x * 10);
plw
.
setColor
(
temp_viz
::
Color
(
col_blue
,
col_green
,
col_red
));
...
...
@@ -167,6 +172,8 @@ TEST(Viz_viz3d, accuracy)
cnw
.
setColor
(
temp_viz
::
Color
(
col_blue
,
col_green
,
col_red
));
pcw2
.
setColor
(
temp_viz
::
Color
(
col_blue
,
col_green
,
col_red
));
gw
.
updatePose
(
temp_viz
::
Affine3f
(
0.0
,
0.1
,
0.0
,
cv
::
Vec3f
(
0.0
,
0.0
,
0.0
)));
angle_x
+=
0.1
f
;
angle_y
-=
0.1
f
;
angle_z
+=
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