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
64cdd821
Commit
64cdd821
authored
Jul 25, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trajectory widget constructor with field of view
parent
7d458e85
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+1
-0
shape_widgets.cpp
modules/viz/src/shape_widgets.cpp
+41
-2
No files found.
modules/viz/include/opencv2/viz/widgets.hpp
View file @
64cdd821
...
...
@@ -184,6 +184,7 @@ namespace cv
TrajectoryWidget
(
const
std
::
vector
<
Affine3f
>
&
path
,
int
display_mode
=
TrajectoryWidget
::
DISPLAY_PATH
,
const
Color
&
color
=
Color
::
white
(),
double
scale
=
1.0
);
TrajectoryWidget
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Matx33f
&
K
,
double
scale
=
1.0
,
const
Color
&
color
=
Color
::
white
());
// Camera frustums
TrajectoryWidget
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Vec2f
&
fov
,
double
scale
=
1.0
,
const
Color
&
color
=
Color
::
white
());
// Camera frustums
private
:
struct
ApplyPath
;
...
...
modules/viz/src/shape_widgets.cpp
View file @
64cdd821
...
...
@@ -1248,8 +1248,6 @@ cv::viz::TrajectoryWidget::TrajectoryWidget(const std::vector<Affine3f> &path, i
cv
::
viz
::
TrajectoryWidget
::
TrajectoryWidget
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Matx33f
&
K
,
double
scale
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkAppendPolyData
>
appendFilter
=
vtkSmartPointer
<
vtkAppendPolyData
>::
New
();
vtkSmartPointer
<
vtkCamera
>
camera
=
vtkSmartPointer
<
vtkCamera
>::
New
();
float
f_x
=
K
(
0
,
0
);
float
f_y
=
K
(
1
,
1
);
...
...
@@ -1279,6 +1277,47 @@ cv::viz::TrajectoryWidget::TrajectoryWidget(const std::vector<Affine3f> &path, c
filter
->
SetInput
(
frustumSource
->
GetOutput
());
filter
->
Update
();
vtkSmartPointer
<
vtkAppendPolyData
>
appendFilter
=
vtkSmartPointer
<
vtkAppendPolyData
>::
New
();
ApplyPath
::
applyPath
(
filter
->
GetOutput
(),
appendFilter
,
path
);
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
mapper
->
SetInput
(
appendFilter
->
GetOutput
());
vtkSmartPointer
<
vtkActor
>
actor
=
vtkSmartPointer
<
vtkActor
>::
New
();
actor
->
SetMapper
(
mapper
);
WidgetAccessor
::
setProp
(
*
this
,
actor
);
setColor
(
color
);
}
cv
::
viz
::
TrajectoryWidget
::
TrajectoryWidget
(
const
std
::
vector
<
Affine3f
>
&
path
,
const
Vec2f
&
fov
,
double
scale
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkCamera
>
camera
=
vtkSmartPointer
<
vtkCamera
>::
New
();
camera
->
SetViewAngle
(
fov
[
1
]
*
180
/
CV_PI
);
// Vertical field of view
camera
->
SetPosition
(
0.0
,
0.0
,
0.0
);
camera
->
SetViewUp
(
0.0
,
1.0
,
0.0
);
camera
->
SetFocalPoint
(
0.0
,
0.0
,
1.0
);
camera
->
SetClippingRange
(
0.01
,
scale
);
double
aspect_ratio
=
tan
(
fov
[
0
]
*
0.5
)
/
tan
(
fov
[
1
]
*
0.5
);
double
planesArray
[
24
];
camera
->
GetFrustumPlanes
(
aspect_ratio
,
planesArray
);
vtkSmartPointer
<
vtkPlanes
>
planes
=
vtkSmartPointer
<
vtkPlanes
>::
New
();
planes
->
SetFrustumPlanes
(
planesArray
);
vtkSmartPointer
<
vtkFrustumSource
>
frustumSource
=
vtkSmartPointer
<
vtkFrustumSource
>::
New
();
frustumSource
->
SetPlanes
(
planes
);
frustumSource
->
Update
();
// Extract the edges
vtkSmartPointer
<
vtkExtractEdges
>
filter
=
vtkSmartPointer
<
vtkExtractEdges
>::
New
();
filter
->
SetInput
(
frustumSource
->
GetOutput
());
filter
->
Update
();
vtkSmartPointer
<
vtkAppendPolyData
>
appendFilter
=
vtkSmartPointer
<
vtkAppendPolyData
>::
New
();
ApplyPath
::
applyPath
(
filter
->
GetOutput
(),
appendFilter
,
path
);
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
...
...
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