Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
56819eaf
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
56819eaf
编写于
1月 07, 2014
作者:
A
Anatoly Baksheev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
switched completer API to doubles, updated docs
上级
d2644654
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
119 addition
and
120 deletion
+119
-120
modules/viz/doc/widget.rst
modules/viz/doc/widget.rst
+41
-41
modules/viz/include/opencv2/viz/widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+22
-22
modules/viz/src/clouds.cpp
modules/viz/src/clouds.cpp
+2
-2
modules/viz/src/shapes.cpp
modules/viz/src/shapes.cpp
+54
-55
未找到文件。
modules/viz/doc/widget.rst
浏览文件 @
56819eaf
...
...
@@ -262,8 +262,8 @@ This 3D Widget defines a finite plane. ::
class CV_EXPORTS WPlane : public Widget3D
{
public:
WPlane(const Vec4
f& coefs, float
size = 1.0, const Color &color = Color::white());
WPlane(const Vec4
f& coefs, const Point3f& pt, float
size = 1.0, const Color &color = Color::white());
WPlane(const Vec4
d& coefs, double
size = 1.0, const Color &color = Color::white());
WPlane(const Vec4
d& coefs, const Point3f& pt, double
size = 1.0, const Color &color = Color::white());
private:
/* hidden */
};
...
...
@@ -272,13 +272,13 @@ viz::WPlane::WPlane
-------------------
Constructs a WPlane.
.. ocv:function:: WPlane(const Vec4
f& coefs, float
size = 1.0, const Color &color = Color::white())
.. ocv:function:: WPlane(const Vec4
d& coefs, double
size = 1.0, const Color &color = Color::white())
:param coefs: Plane coefficients as in (A,B,C,D) where Ax + By + Cz + D = 0.
:param size: Size of the plane.
:param color: :ocv:class:`Color` of the plane.
.. ocv:function:: WPlane(const Vec4
f& coefs, const Point3f& pt, float
size = 1.0, const Color &color = Color::white())
.. ocv:function:: WPlane(const Vec4
d& coefs, const Point3f& pt, double
size = 1.0, const Color &color = Color::white())
:param coefs: Plane coefficients as in (A,B,C,D) where Ax + By + Cz + D = 0.
:param pt: Position of the plane.
...
...
@@ -294,14 +294,14 @@ This 3D Widget defines a sphere. ::
class CV_EXPORTS WSphere : public Widget3D
{
public:
WSphere(const cv::Point3f ¢er,
float
radius, int sphere_resolution = 10, const Color &color = Color::white())
WSphere(const cv::Point3f ¢er,
double
radius, int sphere_resolution = 10, const Color &color = Color::white())
};
viz::WSphere::WSphere
---------------------
Constructs a WSphere.
.. ocv:function:: WSphere(const cv::Point3f ¢er,
float
radius, int sphere_resolution = 10, const Color &color = Color::white())
.. ocv:function:: WSphere(const cv::Point3f ¢er,
double
radius, int sphere_resolution = 10, const Color &color = Color::white())
:param center: Center of the sphere.
:param radius: Radius of the sphere.
...
...
@@ -317,14 +317,14 @@ This 3D Widget defines an arrow. ::
class CV_EXPORTS WArrow : public Widget3D
{
public:
WArrow(const Point3f& pt1, const Point3f& pt2,
float
thickness = 0.03, const Color &color = Color::white());
WArrow(const Point3f& pt1, const Point3f& pt2,
double
thickness = 0.03, const Color &color = Color::white());
};
viz::WArrow::WArrow
-----------------------------
Constructs an WArrow.
.. ocv:function:: WArrow(const Point3f& pt1, const Point3f& pt2,
float
thickness = 0.03, const Color &color = Color::white())
.. ocv:function:: WArrow(const Point3f& pt1, const Point3f& pt2,
double
thickness = 0.03, const Color &color = Color::white())
:param pt1: Start point of the arrow.
:param pt2: End point of the arrow.
...
...
@@ -342,14 +342,14 @@ This 3D Widget defines a circle. ::
class CV_EXPORTS WCircle : public Widget3D
{
public:
WCircle(const Point3f& pt,
float radius, float
thickness = 0.01, const Color &color = Color::white());
WCircle(const Point3f& pt,
double radius, double
thickness = 0.01, const Color &color = Color::white());
};
viz::WCircle::WCircle
-------------------------------
Constructs a WCircle.
.. ocv:function:: WCircle(const Point3f& pt,
float radius, float
thickness = 0.01, const Color &color = Color::white())
.. ocv:function:: WCircle(const Point3f& pt,
double radius, double
thickness = 0.01, const Color &color = Color::white())
:param pt: Center of the circle.
:param radius: Radius of the circle.
...
...
@@ -365,14 +365,14 @@ This 3D Widget defines a cylinder. ::
class CV_EXPORTS WCylinder : public Widget3D
{
public:
WCylinder(const Point3f& pt_on_axis, const Point3f& axis_direction,
float
radius, int numsides = 30, const Color &color = Color::white());
WCylinder(const Point3f& pt_on_axis, const Point3f& axis_direction,
double
radius, int numsides = 30, const Color &color = Color::white());
};
viz::WCylinder::WCylinder
-----------------------------------
Constructs a WCylinder.
.. ocv:function:: WCylinder(const Point3f& pt_on_axis, const Point3f& axis_direction,
float
radius, int numsides = 30, const Color &color = Color::white())
.. ocv:function:: WCylinder(const Point3f& pt_on_axis, const Point3f& axis_direction,
double
radius, int numsides = 30, const Color &color = Color::white())
:param pt_on_axis: A point on the axis of the cylinder.
:param axis_direction: Direction of the axis of the cylinder.
...
...
@@ -416,14 +416,14 @@ This 3D Widget represents a coordinate system. ::
class CV_EXPORTS WCoordinateSystem : public Widget3D
{
public:
WCoordinateSystem(
float
scale = 1.0);
WCoordinateSystem(
double
scale = 1.0);
};
viz::WCoordinateSystem::WCoordinateSystem
---------------------------------------------------
Constructs a WCoordinateSystem.
.. ocv:function:: WCoordinateSystem(
float
scale = 1.0)
.. ocv:function:: WCoordinateSystem(
double
scale = 1.0)
:param scale: Determines the size of the axes.
...
...
@@ -463,7 +463,7 @@ This 3D Widget defines a grid. ::
//! Creates grid at the origin
WGrid(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
//! Creates grid based on the plane equation
WGrid(const Vec4
f
&coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
WGrid(const Vec4
d
&coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
private:
/* hidden */
};
...
...
@@ -478,7 +478,7 @@ Constructs a WGrid.
:param spacing: Size of each column and row, respectively.
:param color: :ocv:class:`Color` of the grid.
.. ocv:function: WGrid(const Vec4
f
&coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white())
.. ocv:function: WGrid(const Vec4
d
&coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white())
:param coeffs: Plane coefficients as in (A,B,C,D) where Ax + By + Cz + D = 0.
:param dimensions: Number of columns and rows, respectively.
...
...
@@ -494,7 +494,7 @@ This 3D Widget represents 3D text. The text always faces the camera. ::
class CV_EXPORTS WText3D : public Widget3D
{
public:
WText3D(const String &text, const Point3f &position,
float
text_scale = 1.0, bool face_camera = true, const Color &color = Color::white());
WText3D(const String &text, const Point3f &position,
double
text_scale = 1.0, bool face_camera = true, const Color &color = Color::white());
void setText(const String &text);
String getText() const;
...
...
@@ -504,7 +504,7 @@ viz::WText3D::WText3D
-------------------------------
Constructs a WText3D.
.. ocv:function:: WText3D(const String &text, const Point3f &position,
float
text_scale = 1.0, bool face_camera = true, const Color &color = Color::white())
.. ocv:function:: WText3D(const String &text, const Point3f &position,
double
text_scale = 1.0, bool face_camera = true, const Color &color = Color::white())
:param text: Text content of the widget.
:param position: Position of the text.
...
...
@@ -609,7 +609,7 @@ This 3D Widget represents an image in 3D space. ::
//! Creates 3D image at the origin
WImage3D(const Mat &image, const Size &size);
//! Creates 3D image at a given position, pointing in the direction of the normal, and having the up_vector orientation
WImage3D(const Vec3
f &position, const Vec3f &normal, const Vec3f
&up_vector, const Mat &image, const Size &size);
WImage3D(const Vec3
d &position, const Vec3d &normal, const Vec3d
&up_vector, const Mat &image, const Size &size);
void setImage(const Mat &image);
};
...
...
@@ -623,7 +623,7 @@ Constructs an WImage3D.
:param image: BGR or Gray-Scale image.
:param size: Size of the image.
.. ocv:function:: WImage3D(const Vec3
f &position, const Vec3f &normal, const Vec3f
&up_vector, const Mat &image, const Size &size)
.. ocv:function:: WImage3D(const Vec3
d &position, const Vec3d &normal, const Vec3d
&up_vector, const Mat &image, const Size &size)
:param position: Position of the image.
:param normal: Normal of the plane that represents the image.
...
...
@@ -649,15 +649,15 @@ This 3D Widget represents camera position in a scene by its axes or viewing frus
{
public:
//! Creates camera coordinate frame (axes) at the origin
WCameraPosition(
float
scale = 1.0);
WCameraPosition(
double
scale = 1.0);
//! Creates frustum based on the intrinsic marix K at the origin
WCameraPosition(const Matx33
f &K, float
scale = 1.0, const Color &color = Color::white());
WCameraPosition(const Matx33
d &K, double
scale = 1.0, const Color &color = Color::white());
//! Creates frustum based on the field of view at the origin
WCameraPosition(const Vec2
f &fov, float
scale = 1.0, const Color &color = Color::white());
WCameraPosition(const Vec2
d &fov, double
scale = 1.0, const Color &color = Color::white());
//! Creates frustum and display given image at the far plane
WCameraPosition(const Matx33
f &K, const Mat &img, float
scale = 1.0, const Color &color = Color::white());
WCameraPosition(const Matx33
d &K, const Mat &img, double
scale = 1.0, const Color &color = Color::white());
//! Creates frustum and display given image at the far plane
WCameraPosition(const Vec2
f &fov, const Mat &img, float
scale = 1.0, const Color &color = Color::white());
WCameraPosition(const Vec2
d &fov, const Mat &img, double
scale = 1.0, const Color &color = Color::white());
};
viz::WCameraPosition::WCameraPosition
...
...
@@ -666,7 +666,7 @@ Constructs a WCameraPosition.
- **Display camera coordinate frame.**
.. ocv:function:: WCameraPosition(
float
scale = 1.0)
.. ocv:function:: WCameraPosition(
double
scale = 1.0)
Creates camera coordinate frame at the origin.
...
...
@@ -676,7 +676,7 @@ Constructs a WCameraPosition.
- **Display the viewing frustum.**
.. ocv:function:: WCameraPosition(const Matx33
f &K, float
scale = 1.0, const Color &color = Color::white())
.. ocv:function:: WCameraPosition(const Matx33
d &K, double
scale = 1.0, const Color &color = Color::white())
:param K: Intrinsic matrix of the camera.
:param scale: Scale of the frustum.
...
...
@@ -684,7 +684,7 @@ Constructs a WCameraPosition.
Creates viewing frustum of the camera based on its intrinsic matrix K.
.. ocv:function:: WCameraPosition(const Vec2
f &fov, float
scale = 1.0, const Color &color = Color::white())
.. ocv:function:: WCameraPosition(const Vec2
d &fov, double
scale = 1.0, const Color &color = Color::white())
:param fov: Field of view of the camera (horizontal, vertical).
:param scale: Scale of the frustum.
...
...
@@ -698,7 +698,7 @@ Constructs a WCameraPosition.
- **Display image on the far plane of the viewing frustum.**
.. ocv:function:: WCameraPosition(const Matx33
f &K, const Mat &img, float
scale = 1.0, const Color &color = Color::white())
.. ocv:function:: WCameraPosition(const Matx33
d &K, const Mat &img, double
scale = 1.0, const Color &color = Color::white())
:param K: Intrinsic matrix of the camera.
:param img: BGR or Gray-Scale image that is going to be displayed on the far plane of the frustum.
...
...
@@ -707,7 +707,7 @@ Constructs a WCameraPosition.
Creates viewing frustum of the camera based on its intrinsic matrix K, and displays image on the far end plane.
.. ocv:function:: WCameraPosition(const Vec2
f &fov, const Mat &img, float
scale = 1.0, const Color &color = Color::white())
.. ocv:function:: WCameraPosition(const Vec2
d &fov, const Mat &img, double
scale = 1.0, const Color &color = Color::white())
:param fov: Field of view of the camera (horizontal, vertical).
:param img: BGR or Gray-Scale image that is going to be displayed on the far plane of the frustum.
...
...
@@ -732,14 +732,14 @@ 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(InputArray path, int display_mode = WTrajectory::PATH,
float
scale = 1.f, const Color &color = Color::white(),;
WTrajectory(InputArray path, int display_mode = WTrajectory::PATH,
double
scale = 1.f, const Color &color = Color::white(),;
};
viz::WTrajectory::WTrajectory
-----------------------------
Constructs a WTrajectory.
.. ocv:function:: WTrajectory(InputArray path, int display_mode = WTrajectory::PATH,
float
scale = 1.f, const Color &color = Color::white())
.. ocv:function:: WTrajectory(InputArray path, int display_mode = WTrajectory::PATH,
double
scale = 1.f, const Color &color = Color::white())
:param path: List of poses on a trajectory. Takes std::vector<Affine<T>> with T == [float | double]
:param display_mode: Display mode. This can be PATH, FRAMES, and BOTH.
...
...
@@ -762,16 +762,16 @@ This 3D Widget represents a trajectory. ::
{
public:
//! Displays trajectory of the given path by frustums
WTrajectoryFrustums(const std::vector<Affine3d> &path, const Matx33
f &K, float
scale = 1.0, const Color &color = Color::white());
WTrajectoryFrustums(const std::vector<Affine3d> &path, const Matx33
d &K, double
scale = 1.0, const Color &color = Color::white());
//! Displays trajectory of the given path by frustums
WTrajectoryFrustums(const std::vector<Affine3d> &path, const Vec2
f &fov, float
scale = 1.0, const Color &color = Color::white());
WTrajectoryFrustums(const std::vector<Affine3d> &path, const Vec2
d &fov, double
scale = 1.0, const Color &color = Color::white());
};
viz::WTrajectoryFrustums::WTrajectoryFrustums
-----------------------------
Constructs a WTrajectoryFrustums.
.. ocv:function:: WTrajectoryFrustums(const std::vector<Affine3d> &path, const Matx33
f &K, float
scale = 1.0, const Color &color = Color::white())
.. ocv:function:: WTrajectoryFrustums(const std::vector<Affine3d> &path, const Matx33
d &K, double
scale = 1.0, const Color &color = Color::white())
:param path: List of poses on a trajectory.
:param K: Intrinsic matrix of the camera.
...
...
@@ -780,7 +780,7 @@ Constructs a WTrajectoryFrustums.
Displays frustums at each pose of the trajectory.
.. ocv:function:: WTrajectoryFrustums(const std::vector<Affine3d> &path, const Vec2
f &fov, float
scale = 1.0, const Color &color = Color::white())
.. ocv:function:: WTrajectoryFrustums(const std::vector<Affine3d> &path, const Vec2
d &fov, double
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).
...
...
@@ -799,8 +799,8 @@ represent the direction from previous position to the current. ::
class CV_EXPORTS WTrajectorySpheres : public Widget3D
{
public:
WTrajectorySpheres(const std::vector<Affine3d> &path,
float
line_length = 0.05f,
float
init_sphere_radius = 0.021, sphere_radius = 0.007,
WTrajectorySpheres(const std::vector<Affine3d> &path,
double
line_length = 0.05f,
double
init_sphere_radius = 0.021, sphere_radius = 0.007,
Color &line_color = Color::white(), const Color &sphere_color = Color::white());
};
...
...
@@ -808,7 +808,7 @@ viz::WTrajectorySpheres::WTrajectorySpheres
-------------------------------------------
Constructs a WTrajectorySpheres.
.. ocv:function:: WTrajectorySpheres(const std::vector<Affine3d> &path,
float line_length = 0.05f, float init_sphere_radius = 0.021, float
sphere_radius = 0.007, const Color &line_color = Color::white(), const Color &sphere_color = Color::white())
.. ocv:function:: WTrajectorySpheres(const std::vector<Affine3d> &path,
double line_length = 0.05f, double init_sphere_radius = 0.021, double
sphere_radius = 0.007, const Color &line_color = Color::white(), const Color &sphere_color = Color::white())
:param path: List of poses on a trajectory.
:param line_length: Length of the lines.
...
...
@@ -912,7 +912,7 @@ This 3D Widget represents normals of a point cloud. ::
class CV_EXPORTS WCloudNormals : public Widget3D
{
public:
WCloudNormals(InputArray cloud, InputArray normals, int level = 100,
float
scale = 0.02f, const Color &color = Color::white());
WCloudNormals(InputArray cloud, InputArray normals, int level = 100,
double
scale = 0.02f, const Color &color = Color::white());
private:
/* hidden */
...
...
@@ -922,7 +922,7 @@ viz::WCloudNormals::WCloudNormals
---------------------------------
Constructs a WCloudNormals.
.. ocv:function:: WCloudNormals(InputArray cloud, InputArray normals, int level = 100,
float
scale = 0.02f, const Color &color = Color::white())
.. ocv:function:: WCloudNormals(InputArray cloud, InputArray normals, int level = 100,
double
scale = 0.02f, const Color &color = Color::white())
:param cloud: Point set which can be of type: ``CV_32FC3``, ``CV_32FC4``, ``CV_64FC3``, ``CV_64FC4``.
:param normals: A set of normals that has to be of same type with cloud.
...
...
modules/viz/include/opencv2/viz/widgets.hpp
浏览文件 @
56819eaf
...
...
@@ -135,44 +135,44 @@ namespace cv
class
CV_EXPORTS
WLine
:
public
Widget3D
{
public:
WLine
(
const
Point3
f
&
pt1
,
const
Point3f
&
pt2
,
const
Color
&
color
=
Color
::
white
());
WLine
(
const
Point3
d
&
pt1
,
const
Point3d
&
pt2
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WPlane
:
public
Widget3D
{
public:
WPlane
(
const
Vec4
f
&
coefs
,
float
size
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WPlane
(
const
Vec4
f
&
coefs
,
const
Point3f
&
pt
,
float
size
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WPlane
(
const
Vec4
d
&
coefs
,
double
size
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WPlane
(
const
Vec4
d
&
coefs
,
const
Point3d
&
pt
,
double
size
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WSphere
:
public
Widget3D
{
public:
WSphere
(
const
cv
::
Point3
f
&
center
,
float
radius
,
int
sphere_resolution
=
10
,
const
Color
&
color
=
Color
::
white
());
WSphere
(
const
cv
::
Point3
d
&
center
,
double
radius
,
int
sphere_resolution
=
10
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WArrow
:
public
Widget3D
{
public:
WArrow
(
const
Point3
f
&
pt1
,
const
Point3f
&
pt2
,
float
thickness
=
0.03
f
,
const
Color
&
color
=
Color
::
white
());
WArrow
(
const
Point3
d
&
pt1
,
const
Point3d
&
pt2
,
double
thickness
=
0.03
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WCircle
:
public
Widget3D
{
public:
WCircle
(
const
Point3
f
&
pt
,
float
radius
,
float
thickness
=
0.01
f
,
const
Color
&
color
=
Color
::
white
());
WCircle
(
const
Point3
d
&
pt
,
double
radius
,
double
thickness
=
0.01
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WCylinder
:
public
Widget3D
{
public:
WCylinder
(
const
Point3
f
&
pt_on_axis
,
const
Point3f
&
axis_direction
,
float
radius
,
int
numsides
=
30
,
const
Color
&
color
=
Color
::
white
());
WCylinder
(
const
Point3
d
&
pt_on_axis
,
const
Point3d
&
axis_direction
,
double
radius
,
int
numsides
=
30
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WCube
:
public
Widget3D
{
public:
WCube
(
const
Point3
f
&
pt_min
,
const
Point3f
&
pt_max
,
bool
wire_frame
=
true
,
const
Color
&
color
=
Color
::
white
());
WCube
(
const
Point3
d
&
pt_min
,
const
Point3d
&
pt_max
,
bool
wire_frame
=
true
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WPolyLine
:
public
Widget3D
...
...
@@ -196,7 +196,7 @@ namespace cv
class
CV_EXPORTS
WText3D
:
public
Widget3D
{
public:
WText3D
(
const
String
&
text
,
const
Point3
f
&
position
,
float
text_scale
=
1.
f
,
bool
face_camera
=
true
,
const
Color
&
color
=
Color
::
white
());
WText3D
(
const
String
&
text
,
const
Point3
d
&
position
,
double
text_scale
=
1.
,
bool
face_camera
=
true
,
const
Color
&
color
=
Color
::
white
());
void
setText
(
const
String
&
text
);
String
getText
()
const
;
...
...
@@ -216,7 +216,7 @@ namespace cv
//! Creates 3D image at the origin
WImage3D
(
const
Mat
&
image
,
const
Size
&
size
);
//! Creates 3D image at a given position, pointing in the direction of the normal, and having the up_vector orientation
WImage3D
(
const
Vec3
f
&
position
,
const
Vec3f
&
normal
,
const
Vec3f
&
up_vector
,
const
Mat
&
image
,
const
Size
&
size
);
WImage3D
(
const
Vec3
d
&
position
,
const
Vec3d
&
normal
,
const
Vec3d
&
up_vector
,
const
Mat
&
image
,
const
Size
&
size
);
void
setImage
(
const
Mat
&
image
);
};
...
...
@@ -234,24 +234,24 @@ namespace cv
{
public:
//! Creates grid at the origin
WGrid
(
const
Vec2i
&
dimensions
,
const
Vec2
f
&
spacing
,
const
Color
&
color
=
Color
::
white
());
WGrid
(
const
Vec2i
&
dimensions
,
const
Vec2
d
&
spacing
,
const
Color
&
color
=
Color
::
white
());
//! Creates grid based on the plane equation
WGrid
(
const
Vec4
f
&
coeffs
,
const
Vec2i
&
dimensions
,
const
Vec2f
&
spacing
,
const
Color
&
color
=
Color
::
white
());
WGrid
(
const
Vec4
d
&
coeffs
,
const
Vec2i
&
dimensions
,
const
Vec2d
&
spacing
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WCameraPosition
:
public
Widget3D
{
public:
//! Creates camera coordinate frame (axes) at the origin
WCameraPosition
(
float
scale
=
1.
f
);
WCameraPosition
(
double
scale
=
1.0
);
//! Creates frustum based on the intrinsic marix K at the origin
WCameraPosition
(
const
Matx33
f
&
K
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WCameraPosition
(
const
Matx33
d
&
K
,
double
scale
=
1.0
,
const
Color
&
color
=
Color
::
white
());
//! Creates frustum based on the field of view at the origin
WCameraPosition
(
const
Vec2
f
&
fov
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WCameraPosition
(
const
Vec2
d
&
fov
,
double
scale
=
1.0
,
const
Color
&
color
=
Color
::
white
());
//! Creates frustum and display given image at the far plane
WCameraPosition
(
const
Matx33
f
&
K
,
const
Mat
&
img
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WCameraPosition
(
const
Matx33
d
&
K
,
const
Mat
&
img
,
double
scale
=
1.0
,
const
Color
&
color
=
Color
::
white
());
//! Creates frustum and display given image at the far plane
WCameraPosition
(
const
Vec2
f
&
fov
,
const
Mat
&
img
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WCameraPosition
(
const
Vec2
d
&
fov
,
const
Mat
&
img
,
double
scale
=
1.0
,
const
Color
&
color
=
Color
::
white
());
};
/////////////////////////////////////////////////////////////////////////////
...
...
@@ -270,16 +270,16 @@ namespace cv
{
public:
//! Displays trajectory of the given path by frustums
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3d
>
&
path
,
const
Matx33
f
&
K
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3d
>
&
path
,
const
Matx33
d
&
K
,
double
scale
=
1.
,
const
Color
&
color
=
Color
::
white
());
//! Displays trajectory of the given path by frustums
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3d
>
&
path
,
const
Vec2
f
&
fov
,
float
scale
=
1.
f
,
const
Color
&
color
=
Color
::
white
());
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3d
>
&
path
,
const
Vec2
d
&
fov
,
double
scale
=
1.
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WTrajectorySpheres
:
public
Widget3D
{
public:
WTrajectorySpheres
(
const
std
::
vector
<
Affine3d
>
&
path
,
float
line_length
=
0.05
f
,
float
init_sphere_radius
=
0.021
f
,
float
sphere_radius
=
0.007
f
,
const
Color
&
line_color
=
Color
::
white
(),
const
Color
&
sphere_color
=
Color
::
white
());
WTrajectorySpheres
(
const
std
::
vector
<
Affine3d
>
&
path
,
double
line_length
=
0.05
,
double
init_sphere_radius
=
0.021
,
double
sphere_radius
=
0.007
,
const
Color
&
line_color
=
Color
::
white
(),
const
Color
&
sphere_color
=
Color
::
white
());
};
/////////////////////////////////////////////////////////////////////////////
...
...
@@ -308,7 +308,7 @@ namespace cv
class
CV_EXPORTS
WCloudNormals
:
public
Widget3D
{
public:
WCloudNormals
(
InputArray
cloud
,
InputArray
normals
,
int
level
=
64
,
float
scale
=
0.1
f
,
const
Color
&
color
=
Color
::
white
());
WCloudNormals
(
InputArray
cloud
,
InputArray
normals
,
int
level
=
64
,
double
scale
=
0.1
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WMesh
:
public
Widget3D
...
...
modules/viz/src/clouds.cpp
浏览文件 @
56819eaf
...
...
@@ -175,7 +175,7 @@ template<> cv::viz::WCloudCollection cv::viz::Widget::cast<cv::viz::WCloudCollec
///////////////////////////////////////////////////////////////////////////////////////////////
/// Cloud Normals Widget implementation
cv
::
viz
::
WCloudNormals
::
WCloudNormals
(
InputArray
_cloud
,
InputArray
_normals
,
int
level
,
float
scale
,
const
Color
&
color
)
cv
::
viz
::
WCloudNormals
::
WCloudNormals
(
InputArray
_cloud
,
InputArray
_normals
,
int
level
,
double
scale
,
const
Color
&
color
)
{
Mat
cloud
=
_cloud
.
getMat
();
Mat
normals
=
_normals
.
getMat
();
...
...
@@ -207,7 +207,7 @@ cv::viz::WCloudNormals::WCloudNormals(InputArray _cloud, InputArray _normals, in
for
(;
srow
<
send
;
srow
+=
xstep
*
s_chs
,
nrow
+=
xstep
*
n_chs
)
if
(
!
isNan
(
srow
)
&&
!
isNan
(
nrow
))
{
Vec3f
endp
=
Vec3f
(
srow
)
+
Vec3f
(
nrow
)
*
scale
;
Vec3f
endp
=
Vec3f
(
srow
)
+
Vec3f
(
nrow
)
*
(
float
)
scale
;
points
->
InsertNextPoint
(
srow
);
points
->
InsertNextPoint
(
endp
.
val
);
...
...
modules/viz/src/shapes.cpp
浏览文件 @
56819eaf
...
...
@@ -55,7 +55,7 @@ namespace cv
///////////////////////////////////////////////////////////////////////////////////////////////
/// line widget implementation
cv
::
viz
::
WLine
::
WLine
(
const
Point3
f
&
pt1
,
const
Point3f
&
pt2
,
const
Color
&
color
)
cv
::
viz
::
WLine
::
WLine
(
const
Point3
d
&
pt1
,
const
Point3d
&
pt2
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkLineSource
>
line
=
vtkSmartPointer
<
vtkLineSource
>::
New
();
line
->
SetPoint1
(
pt1
.
x
,
pt1
.
y
,
pt1
.
z
);
...
...
@@ -103,11 +103,11 @@ namespace cv { namespace viz { namespace
};
}}}
cv
::
viz
::
WPlane
::
WPlane
(
const
Vec4
f
&
coefs
,
float
size
,
const
Color
&
color
)
cv
::
viz
::
WPlane
::
WPlane
(
const
Vec4
d
&
coefs
,
double
size
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkPlaneSource
>
plane
=
vtkSmartPointer
<
vtkPlaneSource
>::
New
();
plane
->
SetNormal
(
coefs
[
0
],
coefs
[
1
],
coefs
[
2
]);
double
norm
=
cv
::
norm
(
Vec3
f
(
coefs
.
val
));
double
norm
=
cv
::
norm
(
Vec3
d
(
coefs
.
val
));
plane
->
Push
(
-
coefs
[
3
]
/
norm
);
Vec3d
p_center
;
...
...
@@ -123,15 +123,15 @@ cv::viz::WPlane::WPlane(const Vec4f& coefs, float size, const Color &color)
setColor
(
color
);
}
cv
::
viz
::
WPlane
::
WPlane
(
const
Vec4
f
&
coefs
,
const
Point3f
&
pt
,
float
size
,
const
Color
&
color
)
cv
::
viz
::
WPlane
::
WPlane
(
const
Vec4
d
&
coefs
,
const
Point3d
&
pt
,
double
size
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkPlaneSource
>
plane
=
vtkSmartPointer
<
vtkPlaneSource
>::
New
();
Point3
f
coefs3
(
coefs
[
0
],
coefs
[
1
],
coefs
[
2
]);
Point3
d
coefs3
(
coefs
[
0
],
coefs
[
1
],
coefs
[
2
]);
double
norm_sqr
=
1.0
/
coefs3
.
dot
(
coefs3
);
plane
->
SetNormal
(
coefs
[
0
],
coefs
[
1
],
coefs
[
2
]);
double
t
=
coefs3
.
dot
(
pt
)
+
coefs
[
3
];
Vec3
f
p_center
=
pt
-
coefs3
*
t
*
norm_sqr
;
Vec3
d
p_center
=
pt
-
coefs3
*
t
*
norm_sqr
;
plane
->
SetCenter
(
p_center
[
0
],
p_center
[
1
],
p_center
[
2
]);
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
...
...
@@ -153,7 +153,7 @@ template<> cv::viz::WPlane cv::viz::Widget::cast<cv::viz::WPlane>()
///////////////////////////////////////////////////////////////////////////////////////////////
/// sphere widget implementation
cv
::
viz
::
WSphere
::
WSphere
(
const
Point3
f
&
center
,
float
radius
,
int
sphere_resolution
,
const
Color
&
color
)
cv
::
viz
::
WSphere
::
WSphere
(
const
Point3
d
&
center
,
double
radius
,
int
sphere_resolution
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkSphereSource
>
sphere
=
vtkSmartPointer
<
vtkSphereSource
>::
New
();
sphere
->
SetRadius
(
radius
);
...
...
@@ -181,7 +181,7 @@ template<> cv::viz::WSphere cv::viz::Widget::cast<cv::viz::WSphere>()
///////////////////////////////////////////////////////////////////////////////////////////////
/// arrow widget implementation
cv
::
viz
::
WArrow
::
WArrow
(
const
Point3
f
&
pt1
,
const
Point3f
&
pt2
,
float
thickness
,
const
Color
&
color
)
cv
::
viz
::
WArrow
::
WArrow
(
const
Point3
d
&
pt1
,
const
Point3d
&
pt2
,
double
thickness
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkArrowSource
>
arrowSource
=
vtkSmartPointer
<
vtkArrowSource
>::
New
();
arrowSource
->
SetShaftRadius
(
thickness
);
...
...
@@ -231,7 +231,7 @@ template<> cv::viz::WArrow cv::viz::Widget::cast<cv::viz::WArrow>()
///////////////////////////////////////////////////////////////////////////////////////////////
/// circle widget implementation
cv
::
viz
::
WCircle
::
WCircle
(
const
Point3
f
&
pt
,
float
radius
,
float
thickness
,
const
Color
&
color
)
cv
::
viz
::
WCircle
::
WCircle
(
const
Point3
d
&
pt
,
double
radius
,
double
thickness
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkDiskSource
>
disk
=
vtkSmartPointer
<
vtkDiskSource
>::
New
();
// Maybe the resolution should be lower e.g. 50 or 25
...
...
@@ -267,9 +267,9 @@ template<> cv::viz::WCircle cv::viz::Widget::cast<cv::viz::WCircle>()
///////////////////////////////////////////////////////////////////////////////////////////////
/// cylinder widget implementation
cv
::
viz
::
WCylinder
::
WCylinder
(
const
Point3
f
&
pt_on_axis
,
const
Point3f
&
axis_direction
,
float
radius
,
int
numsides
,
const
Color
&
color
)
cv
::
viz
::
WCylinder
::
WCylinder
(
const
Point3
d
&
pt_on_axis
,
const
Point3d
&
axis_direction
,
double
radius
,
int
numsides
,
const
Color
&
color
)
{
const
Point3
f
pt2
=
pt_on_axis
+
axis_direction
;
const
Point3
d
pt2
=
pt_on_axis
+
axis_direction
;
vtkSmartPointer
<
vtkLineSource
>
line
=
vtkSmartPointer
<
vtkLineSource
>::
New
();
line
->
SetPoint1
(
pt_on_axis
.
x
,
pt_on_axis
.
y
,
pt_on_axis
.
z
);
line
->
SetPoint2
(
pt2
.
x
,
pt2
.
y
,
pt2
.
z
);
...
...
@@ -298,7 +298,7 @@ template<> cv::viz::WCylinder cv::viz::Widget::cast<cv::viz::WCylinder>()
///////////////////////////////////////////////////////////////////////////////////////////////
/// cylinder widget implementation
cv
::
viz
::
WCube
::
WCube
(
const
Point3
f
&
pt_min
,
const
Point3f
&
pt_max
,
bool
wire_frame
,
const
Color
&
color
)
cv
::
viz
::
WCube
::
WCube
(
const
Point3
d
&
pt_min
,
const
Point3d
&
pt_max
,
bool
wire_frame
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
if
(
wire_frame
)
...
...
@@ -330,7 +330,7 @@ template<> cv::viz::WCube cv::viz::Widget::cast<cv::viz::WCube>()
///////////////////////////////////////////////////////////////////////////////////////////////
/// coordinate system widget implementation
cv
::
viz
::
WCoordinateSystem
::
WCoordinateSystem
(
float
scale
)
cv
::
viz
::
WCoordinateSystem
::
WCoordinateSystem
(
double
scale
)
{
vtkSmartPointer
<
vtkAxes
>
axes
=
vtkSmartPointer
<
vtkAxes
>::
New
();
axes
->
SetOrigin
(
0
,
0
,
0
);
...
...
@@ -461,7 +461,7 @@ namespace cv { namespace viz { namespace
};
}}}
cv
::
viz
::
WGrid
::
WGrid
(
const
Vec2i
&
dimensions
,
const
Vec2
f
&
spacing
,
const
Color
&
color
)
cv
::
viz
::
WGrid
::
WGrid
(
const
Vec2i
&
dimensions
,
const
Vec2
d
&
spacing
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkPolyData
>
grid
=
GridUtils
::
createGrid
(
dimensions
,
spacing
);
...
...
@@ -479,14 +479,14 @@ cv::viz::WGrid::WGrid(const Vec2i &dimensions, const Vec2f &spacing, const Color
setColor
(
color
);
}
cv
::
viz
::
WGrid
::
WGrid
(
const
Vec4
f
&
coefs
,
const
Vec2i
&
dimensions
,
const
Vec2f
&
spacing
,
const
Color
&
color
)
cv
::
viz
::
WGrid
::
WGrid
(
const
Vec4
d
&
coefs
,
const
Vec2i
&
dimensions
,
const
Vec2d
&
spacing
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkPolyData
>
grid
=
GridUtils
::
createGrid
(
dimensions
,
spacing
);
// Estimate the transform to set the normal based on the coefficients
Vec3d
normal
(
coefs
[
0
],
coefs
[
1
],
coefs
[
2
]);
Vec3d
up_vector
(
0.0
,
1.0
,
0.0
);
// Just set as default
double
push_distance
=
-
coefs
[
3
]
/
cv
::
norm
(
Vec3
f
(
coefs
.
val
));
double
push_distance
=
-
coefs
[
3
]
/
cv
::
norm
(
Vec3
d
(
coefs
.
val
));
Vec3d
n
=
normalize
(
normal
);
Vec3d
u
=
normalize
(
up_vector
.
cross
(
n
));
Vec3d
v
=
n
.
cross
(
u
);
...
...
@@ -525,7 +525,7 @@ template<> cv::viz::WGrid cv::viz::Widget::cast<cv::viz::WGrid>()
///////////////////////////////////////////////////////////////////////////////////////////////
/// text3D widget implementation
cv
::
viz
::
WText3D
::
WText3D
(
const
String
&
text
,
const
Point3
f
&
position
,
float
text_scale
,
bool
face_camera
,
const
Color
&
color
)
cv
::
viz
::
WText3D
::
WText3D
(
const
String
&
text
,
const
Point3
d
&
position
,
double
text_scale
,
bool
face_camera
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkVectorText
>
textSource
=
vtkSmartPointer
<
vtkVectorText
>::
New
();
textSource
->
SetText
(
text
.
c_str
());
...
...
@@ -759,7 +759,7 @@ cv::viz::WImage3D::WImage3D(const Mat &image, const Size &size)
WidgetAccessor
::
setProp
(
*
this
,
actor
);
}
cv
::
viz
::
WImage3D
::
WImage3D
(
const
Vec3
f
&
position
,
const
Vec3f
&
normal
,
const
Vec3f
&
up_vector
,
const
Mat
&
image
,
const
Size
&
size
)
cv
::
viz
::
WImage3D
::
WImage3D
(
const
Vec3
d
&
position
,
const
Vec3d
&
normal
,
const
Vec3d
&
up_vector
,
const
Mat
&
image
,
const
Size
&
size
)
{
CV_Assert
(
!
image
.
empty
()
&&
image
.
depth
()
==
CV_8U
);
...
...
@@ -857,7 +857,7 @@ namespace cv { namespace viz { namespace
{
struct
CameraPositionUtils
{
static
void
projectImage
(
float
fovy
,
float
far_end_height
,
const
Mat
&
image
,
static
void
projectImage
(
double
fovy
,
double
far_end_height
,
const
Mat
&
image
,
double
scale
,
const
Color
&
color
,
vtkSmartPointer
<
vtkActor
>
actor
)
{
// Create a camera
...
...
@@ -950,7 +950,7 @@ namespace cv { namespace viz { namespace
};
}}}
cv
::
viz
::
WCameraPosition
::
WCameraPosition
(
float
scale
)
cv
::
viz
::
WCameraPosition
::
WCameraPosition
(
double
scale
)
{
vtkSmartPointer
<
vtkAxes
>
axes
=
vtkSmartPointer
<
vtkAxes
>::
New
();
axes
->
SetOrigin
(
0
,
0
,
0
);
...
...
@@ -992,20 +992,20 @@ cv::viz::WCameraPosition::WCameraPosition(float scale)
WidgetAccessor
::
setProp
(
*
this
,
actor
);
}
cv
::
viz
::
WCameraPosition
::
WCameraPosition
(
const
Matx33
f
&
K
,
float
scale
,
const
Color
&
color
)
cv
::
viz
::
WCameraPosition
::
WCameraPosition
(
const
Matx33
d
&
K
,
double
scale
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkCamera
>
camera
=
vtkSmartPointer
<
vtkCamera
>::
New
();
float
f_x
=
K
(
0
,
0
);
float
f_y
=
K
(
1
,
1
);
float
c_y
=
K
(
1
,
2
);
float
aspect_ratio
=
f_y
/
f_x
;
double
f_x
=
K
(
0
,
0
);
double
f_y
=
K
(
1
,
1
);
double
c_y
=
K
(
1
,
2
);
double
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_y
)
*
180
/
CV_PI
;
double
fovy
=
2.0
*
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
->
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
];
...
...
@@ -1014,8 +1014,7 @@ cv::viz::WCameraPosition::WCameraPosition(const Matx33f &K, float scale, const C
vtkSmartPointer
<
vtkPlanes
>
planes
=
vtkSmartPointer
<
vtkPlanes
>::
New
();
planes
->
SetFrustumPlanes
(
planesArray
);
vtkSmartPointer
<
vtkFrustumSource
>
frustumSource
=
vtkSmartPointer
<
vtkFrustumSource
>::
New
();
vtkSmartPointer
<
vtkFrustumSource
>
frustumSource
=
vtkSmartPointer
<
vtkFrustumSource
>::
New
();
frustumSource
->
SetPlanes
(
planes
);
frustumSource
->
Update
();
...
...
@@ -1034,14 +1033,14 @@ cv::viz::WCameraPosition::WCameraPosition(const Matx33f &K, float scale, const C
}
cv
::
viz
::
WCameraPosition
::
WCameraPosition
(
const
Vec2
f
&
fov
,
float
scale
,
const
Color
&
color
)
cv
::
viz
::
WCameraPosition
::
WCameraPosition
(
const
Vec2
d
&
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
->
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
);
...
...
@@ -1072,25 +1071,25 @@ cv::viz::WCameraPosition::WCameraPosition(const Vec2f &fov, float scale, const C
setColor
(
color
);
}
cv
::
viz
::
WCameraPosition
::
WCameraPosition
(
const
Matx33
f
&
K
,
const
Mat
&
image
,
float
scale
,
const
Color
&
color
)
cv
::
viz
::
WCameraPosition
::
WCameraPosition
(
const
Matx33
d
&
K
,
const
Mat
&
image
,
double
scale
,
const
Color
&
color
)
{
CV_Assert
(
!
image
.
empty
()
&&
image
.
depth
()
==
CV_8U
);
float
f_y
=
K
(
1
,
1
);
float
c_y
=
K
(
1
,
2
);
double
f_y
=
K
(
1
,
1
);
double
c_y
=
K
(
1
,
2
);
// 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_y
)
*
180.0
f
/
CV_PI
;
float
far_end_height
=
2.0
f
*
c_y
*
scale
/
f_y
;
double
fovy
=
2.0
*
atan2
(
c_y
,
f_y
)
*
180.0
/
CV_PI
;
double
far_end_height
=
2.0
f
*
c_y
*
scale
/
f_y
;
vtkSmartPointer
<
vtkActor
>
actor
=
vtkSmartPointer
<
vtkActor
>::
New
();
CameraPositionUtils
::
projectImage
(
fovy
,
far_end_height
,
image
,
scale
,
color
,
actor
);
WidgetAccessor
::
setProp
(
*
this
,
actor
);
}
cv
::
viz
::
WCameraPosition
::
WCameraPosition
(
const
Vec2
f
&
fov
,
const
Mat
&
image
,
float
scale
,
const
Color
&
color
)
cv
::
viz
::
WCameraPosition
::
WCameraPosition
(
const
Vec2
d
&
fov
,
const
Mat
&
image
,
double
scale
,
const
Color
&
color
)
{
CV_Assert
(
!
image
.
empty
()
&&
image
.
depth
()
==
CV_8U
);
float
fovy
=
fov
[
1
]
*
180.0
f
/
CV_PI
;
float
far_end_height
=
2.0
*
scale
*
tan
(
fov
[
1
]
*
0.5
);
double
fovy
=
fov
[
1
]
*
180.0
/
CV_PI
;
double
far_end_height
=
2.0
*
scale
*
tan
(
fov
[
1
]
*
0.5
);
vtkSmartPointer
<
vtkActor
>
actor
=
vtkSmartPointer
<
vtkActor
>::
New
();
CameraPositionUtils
::
projectImage
(
fovy
,
far_end_height
,
image
,
scale
,
color
,
actor
);
...
...
@@ -1141,7 +1140,7 @@ namespace cv { namespace viz { namespace
};
}}}
cv
::
viz
::
WTrajectory
::
WTrajectory
(
InputArray
_path
,
int
display_mode
,
float
scale
,
const
Color
&
color
)
cv
::
viz
::
WTrajectory
::
WTrajectory
(
InputArray
_path
,
int
display_mode
,
double
scale
,
const
Color
&
color
)
{
CV_Assert
(
_path
.
kind
()
==
_InputArray
::
STD_VECTOR
||
_path
.
kind
()
==
_InputArray
::
MAT
);
CV_Assert
(
_path
.
type
()
==
CV_32FC
(
16
)
||
_path
.
type
()
==
CV_64FC
(
16
));
...
...
@@ -1259,15 +1258,15 @@ template<> cv::viz::WTrajectory cv::viz::Widget::cast<cv::viz::WTrajectory>()
///////////////////////////////////////////////////////////////////////////////////////////////
/// WTrajectoryFrustums widget implementation
cv
::
viz
::
WTrajectoryFrustums
::
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3d
>
&
path
,
const
Matx33
f
&
K
,
float
scale
,
const
Color
&
color
)
cv
::
viz
::
WTrajectoryFrustums
::
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3d
>
&
path
,
const
Matx33
d
&
K
,
double
scale
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkCamera
>
camera
=
vtkSmartPointer
<
vtkCamera
>::
New
();
float
f_x
=
K
(
0
,
0
);
float
f_y
=
K
(
1
,
1
);
float
c_y
=
K
(
1
,
2
);
float
aspect_ratio
=
f_y
/
f_x
;
double
f_x
=
K
(
0
,
0
);
double
f_y
=
K
(
1
,
1
);
double
c_y
=
K
(
1
,
2
);
double
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_y
)
*
180
/
CV_PI
;
double
fovy
=
2.0
*
atan2
(
c_y
,
f_y
)
*
180
/
CV_PI
;
camera
->
SetViewAngle
(
fovy
);
camera
->
SetPosition
(
0.0
,
0.0
,
0.0
);
...
...
@@ -1303,14 +1302,14 @@ cv::viz::WTrajectoryFrustums::WTrajectoryFrustums(const std::vector<Affine3d> &p
setColor
(
color
);
}
cv
::
viz
::
WTrajectoryFrustums
::
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3d
>
&
path
,
const
Vec2
f
&
fov
,
float
scale
,
const
Color
&
color
)
cv
::
viz
::
WTrajectoryFrustums
::
WTrajectoryFrustums
(
const
std
::
vector
<
Affine3d
>
&
path
,
const
Vec2
d
&
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
->
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
);
...
...
@@ -1352,7 +1351,7 @@ template<> cv::viz::WTrajectoryFrustums cv::viz::Widget::cast<cv::viz::WTrajecto
///////////////////////////////////////////////////////////////////////////////////////////////
/// WTrajectorySpheres widget implementation
cv
::
viz
::
WTrajectorySpheres
::
WTrajectorySpheres
(
const
std
::
vector
<
Affine3d
>
&
path
,
float
line_length
,
float
init_sphere_radius
,
float
sphere_radius
,
cv
::
viz
::
WTrajectorySpheres
::
WTrajectorySpheres
(
const
std
::
vector
<
Affine3d
>
&
path
,
double
line_length
,
double
init_sphere_radius
,
double
sphere_radius
,
const
Color
&
line_color
,
const
Color
&
sphere_color
)
{
vtkSmartPointer
<
vtkAppendPolyData
>
appendFilter
=
vtkSmartPointer
<
vtkAppendPolyData
>::
New
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录