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
2294eb82
Commit
2294eb82
authored
Jul 18, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix aspect_ratio in camera position widget, add scale parameter (tentative implementation of scale)
parent
9d3f3c66
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
+10
-9
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+1
-1
shape_widgets.cpp
modules/viz/src/shape_widgets.cpp
+6
-7
test_viz3d.cpp
modules/viz/test/test_viz3d.cpp
+3
-1
No files found.
modules/viz/include/opencv2/viz/widgets.hpp
View file @
2294eb82
...
...
@@ -169,7 +169,7 @@ namespace cv
public
:
CameraPositionWidget
(
double
scale
=
1.0
);
CameraPositionWidget
(
const
Vec3f
&
position
,
const
Vec3f
&
look_at
,
const
Vec3f
&
up_vector
,
double
scale
=
1.0
);
CameraPositionWidget
(
const
Matx33f
&
K
,
const
Color
&
color
=
Color
::
white
());
CameraPositionWidget
(
const
Matx33f
&
K
,
double
scale
=
1.0
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
CloudWidget
:
public
Widget3D
...
...
modules/viz/src/shape_widgets.cpp
View file @
2294eb82
...
...
@@ -881,22 +881,21 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(const Vec3f &position, const
WidgetAccessor
::
setProp
(
*
this
,
actor
);
}
cv
::
viz
::
CameraPositionWidget
::
CameraPositionWidget
(
const
Matx33f
&
K
,
const
Color
&
color
)
cv
::
viz
::
CameraPositionWidget
::
CameraPositionWidget
(
const
Matx33f
&
K
,
double
scale
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkCamera
>
camera
=
vtkSmartPointer
<
vtkCamera
>::
New
();
float
f
ocal_length
=
K
(
0
,
0
);
float
c_x
=
K
(
0
,
2
);
float
f
_x
=
K
(
0
,
0
);
float
f_y
=
K
(
1
,
1
);
float
c_y
=
K
(
1
,
2
);
float
aspect_ratio
=
c_x
/
c_y
;
float
img_width
=
c_x
*
2
;
float
img_height
=
c_y
*
2
;
float
aspect_ratio
=
f_y
/
f_x
;
// Assuming that this is an ideal camera (c_y and c_x are at the center of the image)
float
fovy
=
2.0
f
*
atan2
(
c_y
,
f
ocal_length
)
*
180
/
CV_PI
;
float
fovy
=
2.0
f
*
atan2
(
c_y
,
f
_y
)
*
180
/
CV_PI
;
camera
->
SetViewAngle
(
fovy
);
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
*
f_y
*
0.001
);
double
planesArray
[
24
];
camera
->
GetFrustumPlanes
(
aspect_ratio
,
planesArray
);
...
...
modules/viz/test/test_viz3d.cpp
View file @
2294eb82
...
...
@@ -144,7 +144,8 @@ TEST(Viz_viz3d, accuracy)
viz
::
CameraPositionWidget
cpw
(
Vec3f
(
0.5
,
0.5
,
3.0
),
Vec3f
(
0.0
,
0.0
,
0.0
),
Vec3f
(
0.0
,
-
1.0
,
0.0
),
0.5
);
viz
::
CameraPositionWidget
cpw2
(
0.5
);
viz
::
CameraPositionWidget
frustum
(
K
,
viz
::
Color
::
green
());
viz
::
CameraPositionWidget
frustum
(
K
,
2.0
,
viz
::
Color
::
green
());
viz
::
CameraPositionWidget
frustum2
(
K
,
4.0
,
viz
::
Color
::
red
());
viz
::
Text3DWidget
t3w1
(
"Camera1"
,
Point3f
(
0.4
,
0.6
,
3.0
),
0.1
);
viz
::
Text3DWidget
t3w2
(
"Camera2"
,
Point3f
(
0
,
0
,
0
),
0.1
);
...
...
@@ -153,6 +154,7 @@ TEST(Viz_viz3d, accuracy)
viz
.
showWidget
(
"camera_label"
,
t3w1
);
viz
.
showWidget
(
"camera_label2"
,
t3w2
,
Affine3f
(
0.524
,
0
,
0
,
Vec3f
(
-
1.0
,
0.5
,
0.5
)));
viz
.
showWidget
(
"frustrum"
,
frustum
,
Affine3f
(
0.524
,
0
,
0
,
Vec3f
(
-
1.0
,
0.5
,
0.5
)));
viz
.
showWidget
(
"frustrum2"
,
frustum2
,
Affine3f
(
0.524
,
0
,
0
,
Vec3f
(
-
1.0
,
0.5
,
0.5
)));
// viz.showWidget("CameraPositionWidget2", cpw2);
// viz.showWidget("CameraPositionWidget3", cpw3);
...
...
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