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
0a3691d6
Commit
0a3691d6
authored
Jul 19, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CameraPositionWidget: constructor with Vec2f fov (tentative)
parent
2294eb82
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletion
+40
-1
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+1
-0
shape_widgets.cpp
modules/viz/src/shape_widgets.cpp
+39
-1
No files found.
modules/viz/include/opencv2/viz/widgets.hpp
View file @
0a3691d6
...
@@ -170,6 +170,7 @@ namespace cv
...
@@ -170,6 +170,7 @@ namespace cv
CameraPositionWidget
(
double
scale
=
1.0
);
CameraPositionWidget
(
double
scale
=
1.0
);
CameraPositionWidget
(
const
Vec3f
&
position
,
const
Vec3f
&
look_at
,
const
Vec3f
&
up_vector
,
double
scale
=
1.0
);
CameraPositionWidget
(
const
Vec3f
&
position
,
const
Vec3f
&
look_at
,
const
Vec3f
&
up_vector
,
double
scale
=
1.0
);
CameraPositionWidget
(
const
Matx33f
&
K
,
double
scale
=
1.0
,
const
Color
&
color
=
Color
::
white
());
CameraPositionWidget
(
const
Matx33f
&
K
,
double
scale
=
1.0
,
const
Color
&
color
=
Color
::
white
());
CameraPositionWidget
(
const
Vec2f
&
fov
,
double
scale
=
1.0
,
const
Color
&
color
=
Color
::
white
());
};
};
class
CV_EXPORTS
CloudWidget
:
public
Widget3D
class
CV_EXPORTS
CloudWidget
:
public
Widget3D
...
...
modules/viz/src/shape_widgets.cpp
View file @
0a3691d6
...
@@ -895,7 +895,7 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(const Matx33f &K, double sca
...
@@ -895,7 +895,7 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(const Matx33f &K, double sca
camera
->
SetPosition
(
0.0
,
0.0
,
0.0
);
camera
->
SetPosition
(
0.0
,
0.0
,
0.0
);
camera
->
SetViewUp
(
0.0
,
1.0
,
0.0
);
camera
->
SetViewUp
(
0.0
,
1.0
,
0.0
);
camera
->
SetFocalPoint
(
0.0
,
0.0
,
1.0
);
camera
->
SetFocalPoint
(
0.0
,
0.0
,
1.0
);
camera
->
SetClippingRange
(
0.01
,
scale
*
f_y
*
0.001
);
camera
->
SetClippingRange
(
0.01
,
scale
);
double
planesArray
[
24
];
double
planesArray
[
24
];
camera
->
GetFrustumPlanes
(
aspect_ratio
,
planesArray
);
camera
->
GetFrustumPlanes
(
aspect_ratio
,
planesArray
);
...
@@ -922,3 +922,41 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(const Matx33f &K, double sca
...
@@ -922,3 +922,41 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(const Matx33f &K, double sca
WidgetAccessor
::
setProp
(
*
this
,
actor
);
WidgetAccessor
::
setProp
(
*
this
,
actor
);
setColor
(
color
);
setColor
(
color
);
}
}
cv
::
viz
::
CameraPositionWidget
::
CameraPositionWidget
(
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
planesArray
[
24
];
// Default aspect ratio = 1.0? fovx/fovy?
camera
->
GetFrustumPlanes
(
1.0
,
planesArray
);
vtkSmartPointer
<
vtkPlanes
>
planes
=
vtkSmartPointer
<
vtkPlanes
>::
New
();
planes
->
SetFrustumPlanes
(
planesArray
);
vtkSmartPointer
<
vtkFrustumSource
>
frustumSource
=
vtkSmartPointer
<
vtkFrustumSource
>::
New
();
frustumSource
->
SetPlanes
(
planes
);
frustumSource
->
Update
();
// Extract the edges so we have the grid
vtkSmartPointer
<
vtkExtractEdges
>
filter
=
vtkSmartPointer
<
vtkExtractEdges
>::
New
();
filter
->
SetInput
(
frustumSource
->
GetOutput
());
filter
->
Update
();
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
mapper
->
SetInput
(
filter
->
GetOutput
());
vtkSmartPointer
<
vtkActor
>
actor
=
vtkSmartPointer
<
vtkActor
>::
New
();
actor
->
SetMapper
(
mapper
);
WidgetAccessor
::
setProp
(
*
this
,
actor
);
setColor
(
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