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
31d42ce1
Commit
31d42ce1
authored
Dec 08, 2013
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored Trajectory: split into Trajectory and TrajectoryFrustums)
parent
54fa69ca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
25 deletions
+52
-25
widget.rst
modules/viz/doc/widget.rst
+24
-12
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+13
-7
shape_widgets.cpp
modules/viz/src/shape_widgets.cpp
+15
-6
No files found.
modules/viz/doc/widget.rst
View file @
31d42ce1
...
...
@@ -732,26 +732,19 @@ This 3D Widget represents a trajectory. ::
enum {FRAMES = 1, PATH = 2, BOTH = FRAMES + PATH};
//! Displays trajectory of the given path either by coordinate frames or polyline
WTrajectory(const std::vector<Affine3f> &path, int display_mode = WTrajectory::PATH, const Color &color = Color::white(), float scale = 1.0);
//! Displays trajectory of the given path by frustums
WTrajectory(const std::vector<Affine3f> &path, const Matx33f &K, float scale = 1.0, const Color &color = Color::white());
//! Displays trajectory of the given path by frustums
WTrajectory(const std::vector<Affine3f> &path, const Vec2f &fov, float scale = 1.0, const Color &color = Color::white());
private:
/* hidden */
WTrajectory(const std::vector<Affine3f> &path, int display_mode = WTrajectory::PATH, float scale = 1.f, const Color &color = Color::white(),;
};
viz::WTrajectory::WTrajectory
-----------------------------
Constructs a WTrajectory.
.. ocv:function:: WTrajectory(const std::vector<Affine3f> &path, int display_mode = WTrajectory::PATH,
const Color &color = Color::white(), float scale = 1.0
)
.. ocv:function:: WTrajectory(const std::vector<Affine3f> &path, int display_mode = WTrajectory::PATH,
float scale = 1.f, const Color &color = Color::white()
)
:param path: List of poses on a trajectory.
:param display_mode: Display mode. This can be PATH, FRAMES, and BOTH.
:param color: :ocv:class:`Color` of the polyline that represents path. Frames are not affected.
:param scale: Scale of the frames. Polyline is not affected.
:param color: :ocv:class:`Color` of the polyline that represents path. Frames are not affected.
Displays trajectory of the given path as follows:
...
...
@@ -759,7 +752,26 @@ Constructs a WTrajectory.
* FRAMES : Displays coordinate frames at each pose.
* PATH & FRAMES : Displays both poly line and coordinate frames.
.. ocv:function:: WTrajectory(const std::vector<Affine3f> &path, const Matx33f &K, float scale = 1.0, const Color &color = Color::white())
viz::WTrajectoryFrustums
----------------
.. ocv:class:: WTrajectoryFrustums
This 3D Widget represents a trajectory. ::
class CV_EXPORTS WTrajectoryFrustums : public Widget3D
{
public:
//! Displays trajectory of the given path by frustums
WTrajectoryFrustums(const std::vector<Affine3f> &path, const Matx33f &K, float scale = 1.0, const Color &color = Color::white());
//! Displays trajectory of the given path by frustums
WTrajectoryFrustums(const std::vector<Affine3f> &path, const Vec2f &fov, float scale = 1.0, const Color &color = Color::white());
};
viz::WTrajectoryFrustums::WTrajectoryFrustums
-----------------------------
Constructs a WTrajectoryFrustums.
.. ocv:function:: WTrajectoryFrustums(const std::vector<Affine3f> &path, const Matx33f &K, float scale = 1.0, const Color &color = Color::white())
:param path: List of poses on a trajectory.
:param K: Intrinsic matrix of the camera.
...
...
@@ -768,7 +780,7 @@ Constructs a WTrajectory.
Displays frustums at each pose of the trajectory.
.. ocv:function:: WTrajectory(const std::vector<Affine3f> &path, const Vec2f &fov, float scale = 1.0, const Color &color = Color::white())
.. ocv:function:: WTrajectory
Frustums
(const std::vector<Affine3f> &path, const Vec2f &fov, float scale = 1.0, const Color &color = Color::white())
:param path: List of poses on a trajectory.
:param fov: Field of view of the camera (horizontal, vertical).
...
...
modules/viz/include/opencv2/viz/widgets.hpp
View file @
31d42ce1
...
...
@@ -245,13 +245,13 @@ namespace cv
//! Creates camera coordinate frame (axes) at the origin
WCameraPosition
(
float
scale
=
1.
f
);
//! Creates frustum based on the intrinsic marix K at the origin
WCameraPosition
(
const
Matx33f
&
K
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
explicit
WCameraPosition
(
const
Matx33f
&
K
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
//! Creates frustum based on the field of view at the origin
WCameraPosition
(
const
Vec2f
&
fov
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
explicit
WCameraPosition
(
const
Vec2f
&
fov
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
//! Creates frustum and display given image at the far plane
WCameraPosition
(
const
Matx33f
&
K
,
const
Mat
&
img
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
explicit
WCameraPosition
(
const
Matx33f
&
K
,
const
Mat
&
img
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
//! Creates frustum and display given image at the far plane
WCameraPosition
(
const
Vec2f
&
fov
,
const
Mat
&
img
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
explicit
WCameraPosition
(
const
Vec2f
&
fov
,
const
Mat
&
img
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WTrajectory
:
public
Widget3D
...
...
@@ -260,11 +260,16 @@ namespace cv
enum
{
FRAMES
=
1
,
PATH
=
2
,
BOTH
=
FRAMES
+
PATH
};
//! Displays trajectory of the given path either by coordinate frames or polyline
WTrajectory
(
const
std
::
vector
<
Affine3f
>
&
path
,
int
display_mode
=
WTrajectory
::
PATH
,
const
Color
&
color
=
Color
::
white
(),
float
scale
=
1.
f
);
WTrajectory
(
const
std
::
vector
<
Affine3f
>
&
path
,
int
display_mode
=
WTrajectory
::
PATH
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WTrajectoryFrustums
:
public
Widget3D
{
public
:
//! Displays trajectory of the given path by frustums
WTrajectory
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Matx33f
&
K
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
explicit
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Matx33f
&
K
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
//! Displays trajectory of the given path by frustums
WTrajectory
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Vec2f
&
fov
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
explicit
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Vec2f
&
fov
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WTrajectorySpheres
:
public
Widget3D
...
...
@@ -330,6 +335,7 @@ namespace cv
template
<>
CV_EXPORTS
WImage3D
Widget
::
cast
<
WImage3D
>
();
template
<>
CV_EXPORTS
WCameraPosition
Widget
::
cast
<
WCameraPosition
>
();
template
<>
CV_EXPORTS
WTrajectory
Widget
::
cast
<
WTrajectory
>
();
template
<>
CV_EXPORTS
WTrajectoryFrustums
Widget
::
cast
<
WTrajectoryFrustums
>
();
template
<>
CV_EXPORTS
WTrajectorySpheres
Widget
::
cast
<
WTrajectorySpheres
>
();
template
<>
CV_EXPORTS
WCloud
Widget
::
cast
<
WCloud
>
();
template
<>
CV_EXPORTS
WCloudCollection
Widget
::
cast
<
WCloudCollection
>
();
...
...
modules/viz/src/shape_widgets.cpp
View file @
31d42ce1
...
...
@@ -1235,7 +1235,7 @@ namespace cv { namespace viz { namespace
};
}}}
cv
::
viz
::
WTrajectory
::
WTrajectory
(
const
std
::
vector
<
Affine3f
>
&
path
,
int
display_mode
,
const
Color
&
color
,
float
scale
)
cv
::
viz
::
WTrajectory
::
WTrajectory
(
const
std
::
vector
<
Affine3f
>
&
path
,
int
display_mode
,
float
scale
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkAppendPolyData
>
appendFilter
=
vtkSmartPointer
<
vtkAppendPolyData
>::
New
();
...
...
@@ -1331,7 +1331,16 @@ cv::viz::WTrajectory::WTrajectory(const std::vector<Affine3f> &path, int display
WidgetAccessor
::
setProp
(
*
this
,
actor
);
}
cv
::
viz
::
WTrajectory
::
WTrajectory
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Matx33f
&
K
,
float
scale
,
const
Color
&
color
)
template
<>
cv
::
viz
::
WTrajectory
cv
::
viz
::
Widget
::
cast
<
cv
::
viz
::
WTrajectory
>
()
{
Widget3D
widget
=
this
->
cast
<
Widget3D
>
();
return
static_cast
<
WTrajectory
&>
(
widget
);
}
///////////////////////////////////////////////////////////////////////////////////////////////
/// WTrajectoryFrustums widget implementation
cv
::
viz
::
WTrajectoryFrustums
::
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Matx33f
&
K
,
float
scale
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkCamera
>
camera
=
vtkSmartPointer
<
vtkCamera
>::
New
();
float
f_x
=
K
(
0
,
0
);
...
...
@@ -1375,7 +1384,7 @@ cv::viz::WTrajectory::WTrajectory(const std::vector<Affine3f> &path, const Matx3
setColor
(
color
);
}
cv
::
viz
::
WTrajectory
::
WTrajectory
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Vec2f
&
fov
,
float
scale
,
const
Color
&
color
)
cv
::
viz
::
WTrajectory
Frustums
::
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Vec2f
&
fov
,
float
scale
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkCamera
>
camera
=
vtkSmartPointer
<
vtkCamera
>::
New
();
...
...
@@ -1415,14 +1424,14 @@ cv::viz::WTrajectory::WTrajectory(const std::vector<Affine3f> &path, const Vec2f
setColor
(
color
);
}
template
<>
cv
::
viz
::
WTrajectory
cv
::
viz
::
Widget
::
cast
<
cv
::
viz
::
WTrajectory
>
()
template
<>
cv
::
viz
::
WTrajectory
Frustums
cv
::
viz
::
Widget
::
cast
<
cv
::
viz
::
WTrajectoryFrustums
>
()
{
Widget3D
widget
=
this
->
cast
<
Widget3D
>
();
return
static_cast
<
WTrajectory
&>
(
widget
);
return
static_cast
<
WTrajectory
Frustums
&>
(
widget
);
}
///////////////////////////////////////////////////////////////////////////////////////////////
///
spheres trajectory
widget implementation
///
WTrajectorySpheres
widget implementation
cv
::
viz
::
WTrajectorySpheres
::
WTrajectorySpheres
(
const
std
::
vector
<
Affine3f
>
&
path
,
float
line_length
,
float
init_sphere_radius
,
float
sphere_radius
,
const
Color
&
line_color
,
const
Color
&
sphere_color
)
...
...
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