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
658f4a7d
Commit
658f4a7d
authored
Jan 12, 2014
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoed plane
parent
53b82186
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
14 deletions
+54
-14
widget.rst
modules/viz/doc/widget.rst
+15
-10
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+5
-2
shapes.cpp
modules/viz/src/shapes.cpp
+30
-0
tests_simple.cpp
modules/viz/test/tests_simple.cpp
+4
-2
No files found.
modules/viz/doc/widget.rst
View file @
658f4a7d
...
...
@@ -274,25 +274,30 @@ This 3D Widget defines a finite plane. ::
class CV_EXPORTS WPlane : public Widget3D
{
public:
WPlane(const Vec4d& coefs, double size = 1.0, const Color &color = Color::white());
WPlane(const Vec4d& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white());
//! created default plane with center point at origin and normal oriented along z-axis
WPlane(const Size2d& size = Size2d(1.0, 1.0), const Color &color = Color::white());
//! repositioned plane
WPlane(const Point3d& center, const Vec3d& normal, const Vec3d& new_plane_yaxis,const Size2d& size = Size2d(1.0, 1.0), const Color &color = Color::white());
};
viz::WPlane::WPlane
-------------------
Constructs a
WPlane
.
Constructs a
default plane with center point at origin and normal oriented along z-axis
.
.. ocv:function:: WPlane(const
Vec4d& coefs, double size = 1.0, const Color &color = Color::white())
.. ocv:function:: WPlane(const
Size2d& size = Size2d(1.0, 1.0), const Color &color = Color::white());
:param coefs: Plane coefficients as in (A,B,C,D) where Ax + By + Cz + D = 0.
:param size: Size of the plane.
:param size: Size of the plane
:param color: :ocv:class:`Color` of the plane.
.. ocv:function:: WPlane(const Vec4d& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white())
viz::WPlane::WPlane
Constructs a repositioned plane
.. ocv:function:: WPlane(const Point3d& center, const Vec3d& normal, const Vec3d& new_plane_yaxis,const Size2d& size = Size2d(1.0, 1.0), const Color &color = Color::white());
:param c
oefs: Plane coefficients as in (A,B,C,D) where Ax + By + Cz + D = 0.
:param
pt: Position of the plane.
:param
size: Size of the plane
.
:param c
enter: Center of the plane
:param
normal: Plane normal orientation
:param
new_plane_yaxis: Up-vector. New orientation of plane y-axis
.
:param color: :ocv:class:`Color` of the plane.
viz::WSphere
...
...
modules/viz/include/opencv2/viz/widgets.hpp
View file @
658f4a7d
...
...
@@ -145,8 +145,11 @@ namespace cv
class
CV_EXPORTS
WPlane
:
public
Widget3D
{
public
:
WPlane
(
const
Vec4d
&
coefs
,
double
size
=
1.0
,
const
Color
&
color
=
Color
::
white
());
WPlane
(
const
Vec4d
&
coefs
,
const
Point3d
&
pt
,
double
size
=
1.0
,
const
Color
&
color
=
Color
::
white
());
//! created default plane with center point at origin and normal oriented along z-axis
WPlane
(
const
Size2d
&
size
=
Size2d
(
1.0
,
1.0
),
const
Color
&
color
=
Color
::
white
());
//! repositioned plane
WPlane
(
const
Point3d
&
center
,
const
Vec3d
&
normal
,
const
Vec3d
&
new_plane_yaxis
,
const
Size2d
&
size
=
Size2d
(
1.0
,
1.0
),
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WSphere
:
public
Widget3D
...
...
modules/viz/src/shapes.cpp
View file @
658f4a7d
...
...
@@ -125,6 +125,36 @@ namespace cv { namespace viz { namespace
};
}}}
cv
::
viz
::
WPlane
::
WPlane
(
const
Size2d
&
size
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkPlaneSource
>
plane
=
vtkSmartPointer
<
vtkPlaneSource
>::
New
();
plane
->
SetOrigin
(
-
0.5
*
size
.
width
,
-
0.5
*
size
.
height
,
0.0
);
plane
->
SetPoint1
(
0.5
*
size
.
width
,
-
0.5
*
size
.
height
,
0.0
);
plane
->
SetPoint2
(
-
0.5
*
size
.
width
,
0.5
*
size
.
height
,
0.0
);
plane
->
Update
();
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
VtkUtils
::
SetInputData
(
mapper
,
plane
->
GetOutput
());
vtkSmartPointer
<
vtkActor
>
actor
=
vtkSmartPointer
<
vtkActor
>::
New
();
actor
->
SetMapper
(
mapper
);
actor
->
GetProperty
()
->
LightingOff
();
WidgetAccessor
::
setProp
(
*
this
,
actor
);
setColor
(
color
);
}
cv
::
viz
::
WPlane
::
WPlane
(
const
Point3d
&
center
,
const
Vec3d
&
normal
,
const
Vec3d
&
new_plane_yaxis
,
const
Size2d
&
size
,
const
Color
&
color
)
{
Vec3d
zvec
=
normalize
(
normal
);
Vec3d
xvec
=
normalize
(
new_plane_yaxis
.
cross
(
zvec
));
Vec3d
yvec
=
zvec
.
cross
(
xvec
);
WPlane
plane
(
size
,
color
);
plane
.
applyTransform
(
makeTransformToGlobal
(
xvec
,
yvec
,
zvec
,
center
));
*
this
=
plane
;
}
cv
::
viz
::
WPlane
::
WPlane
(
const
Vec4d
&
coefs
,
double
size
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkPlaneSource
>
plane
=
vtkSmartPointer
<
vtkPlaneSource
>::
New
();
...
...
modules/viz/test/tests_simple.cpp
View file @
658f4a7d
...
...
@@ -304,16 +304,18 @@ TEST(Viz, show_simple_widgets)
viz
.
showWidget
(
"con1"
,
WCone
(
0.125
,
Point3d
(
0.5
,
-
0.5
,
0.5
),
Point3d
(
0.5
,
-
1.0
,
0.5
),
6
,
Color
::
turquoise
()));
viz
.
showWidget
(
"text2d"
,
WText
(
"Simple text"
,
Point
(
20
,
20
),
20
,
Color
::
green
()));
viz
.
showWidget
(
"text3d"
,
WText3D
(
"Simple 3D text"
,
Point3d
(
0.5
,
0.5
,
0.5
),
0.125
,
false
,
Color
::
green
()));
viz
.
showWidget
(
"plane1"
,
WPlane
(
Size2d
(
0.25
,
0.75
)));
viz
.
showWidget
(
"plane2"
,
WPlane
(
Vec3d
(
0.5
,
-
0.5
,
-
0.5
),
Vec3d
(
0.0
,
1.0
,
1.0
),
Vec3d
(
1.0
,
1.0
,
0.0
),
Size2d
(
1.0
,
0.5
),
Color
::
gold
()));
viz
.
spinOnce
(
1500
,
true
);
viz
.
getWidget
(
"text2d"
).
cast
<
WText
>
().
setText
(
"New simple text"
);
viz
.
getWidget
(
"text3d"
).
cast
<
WText3D
>
().
setText
(
"Updated text 3D"
);
viz
.
spin
();
}
TEST
(
Viz
,
show_follower
)
TEST
(
Viz
,
DISABLED_
show_follower
)
{
Viz3d
viz
(
"show_follower"
);
...
...
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