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
0bb89e76
Commit
0bb89e76
authored
Aug 04, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix field of view formula in camera class, implement get camera
parent
f445f762
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
types.cpp
modules/viz/src/types.cpp
+1
-1
viz3d_impl.cpp
modules/viz/src/viz3d_impl.cpp
+10
-0
viz3d_impl.hpp
modules/viz/src/viz3d_impl.hpp
+1
-0
No files found.
modules/viz/src/types.cpp
View file @
0bb89e76
...
...
@@ -192,7 +192,7 @@ void cv::viz::Camera2::setWindowSize(const Size &window_size)
float
aspect_ratio_new
=
window_size
.
width
/
window_size
.
height
;
if
(
principal_point_
[
0
]
<
0.0
f
)
fov_
[
0
]
=
2
*
atan2
(
tan
(
fov_
[
0
]
*
0.5
),
aspect_ratio_new
);
// This assumes that the lens is symmetric!
fov_
[
0
]
=
2
*
atan2
(
tan
(
fov_
[
1
]
*
0.5
),
aspect_ratio_new
);
// This assumes that the lens is symmetric!
else
fov_
[
0
]
=
(
atan2
(
principal_point_
[
0
],
focal_
[
0
])
+
atan2
(
window_size
.
width
-
principal_point_
[
0
],
focal_
[
0
]))
*
180
/
CV_PI
;
}
modules/viz/src/viz3d_impl.cpp
View file @
0bb89e76
...
...
@@ -603,6 +603,16 @@ void cv::viz::Viz3d::VizImpl::setCamera(const Camera2 &camera)
window_
->
SetSize
(
static_cast
<
int
>
(
camera
.
getWindowSize
().
width
),
static_cast
<
int
>
(
camera
.
getWindowSize
().
height
));
}
/////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
getCamera
(
viz
::
Camera2
&
camera
)
{
vtkCamera
&
active_camera
=
*
renderer_
->
GetActiveCamera
();
camera
.
setFov
(
Vec2f
(
0.0
,
active_camera
.
GetViewAngle
()
*
CV_PI
/
180.0
f
));
camera
.
setClip
(
Vec2d
(
active_camera
.
GetClippingRange
()));
camera
.
setWindowSize
(
Size
(
renderer_
->
GetRenderWindow
()
->
GetSize
()[
0
],
renderer_
->
GetRenderWindow
()
->
GetSize
()[
1
]));
}
/////////////////////////////////////////////////////////////////////////////////////////////
void
cv
::
viz
::
Viz3d
::
VizImpl
::
setViewerPose
(
const
Affine3f
&
pose
)
{
...
...
modules/viz/src/viz3d_impl.hpp
View file @
0bb89e76
...
...
@@ -111,6 +111,7 @@ public:
// and 'Camera' class itself with various constructors/fields
void
setCamera
(
const
Camera2
&
camera
);
void
getCamera
(
Camera2
&
camera
);
void
initCameraParameters
();
/** \brief Initialize camera parameters with some default values. */
bool
cameraParamsSet
()
const
;
/** \brief Checks whether the camera parameters were manually loaded from file.*/
...
...
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