Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
bb891f05
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
bb891f05
编写于
1月 12, 2014
作者:
A
Anatoly Baksheev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added cone implementation
上级
08f50314
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
95 addition
and
1 deletion
+95
-1
modules/viz/doc/widget.rst
modules/viz/doc/widget.rst
+41
-1
modules/viz/include/opencv2/viz/widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+11
-0
modules/viz/src/precomp.hpp
modules/viz/src/precomp.hpp
+1
-0
modules/viz/src/shapes.cpp
modules/viz/src/shapes.cpp
+40
-0
modules/viz/test/tests_simple.cpp
modules/viz/test/tests_simple.cpp
+2
-0
未找到文件。
modules/viz/doc/widget.rst
浏览文件 @
bb891f05
...
...
@@ -349,7 +349,7 @@ viz::WCircle
This 3D Widget defines a circle. ::
class CV_EXPORTS WCircle : public Widget3D
class CV_EXPORTS WCircle : public Widget3D
{
public:
//! creates default planar circle centred at origin with plane normal along z-axis
...
...
@@ -381,6 +381,46 @@ Constructs repositioned planar circle.
:param thickness: Thickness of the circle.
:param color: :ocv:class:`Color` of the circle.
viz::WCone
-----------------
.. ocv:class:: WCone
This 3D Widget defines a cone. ::
class CV_EXPORTS WCone : public Widget3D
{
public:
//! create default cone, oriented along x-axis with center of its base located at origin
WCone(double lenght, double radius, int resolution = 6.0, const Color &color = Color::white());
//! creates repositioned cone
WCone(double radius, const Point3d& center, const Point3d& tip, int resolution = 6.0, const Color &color = Color::white());
};
viz::WCone::WCone
-------------------------------
Constructs default cone oriented along x-axis with center of its base located at origin
.. ocv:function:: WCone(double length, double radius, int resolution = 6.0, const Color &color = Color::white());
:param length: Length of the cone.
:param radius: Radius of the cone.
:param resolution: Resolution of the cone.
:param color: :ocv:class:`Color` of the cone.
viz::WCone::WCone
-------------------------------
Constructs repositioned planar cone.
.. ocv:function:: WCone(double radius, const Point3d& center, const Point3d& tip, int resolution = 6.0, const Color &color = Color::white());
:param radius: Radius of the cone.
:param center: Center of the cone base.
:param tip: Tip of the cone.
:param resolution: Resolution of the cone.
:param color: :ocv:class:`Color` of the cone.
viz::WCylinder
--------------
.. ocv:class:: WCylinder
...
...
modules/viz/include/opencv2/viz/widgets.hpp
浏览文件 @
bb891f05
...
...
@@ -171,6 +171,16 @@ namespace cv
WCircle
(
double
radius
,
const
Point3d
&
center
,
const
Vec3d
&
normal
,
double
thickness
=
0.01
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WCone
:
public
Widget3D
{
public:
//! create default cone, oriented along x-axis with center of its base located at origin
WCone
(
double
length
,
double
radius
,
int
resolution
=
6.0
,
const
Color
&
color
=
Color
::
white
());
//! creates repositioned cone
WCone
(
double
radius
,
const
Point3d
&
center
,
const
Point3d
&
tip
,
int
resolution
=
6.0
,
const
Color
&
color
=
Color
::
white
());
};
class
CV_EXPORTS
WCylinder
:
public
Widget3D
{
public:
...
...
@@ -341,6 +351,7 @@ namespace cv
template
<
>
CV_EXPORTS
WCylinder
Widget
::
cast
<
WCylinder
>
();
template
<
>
CV_EXPORTS
WArrow
Widget
::
cast
<
WArrow
>
();
template
<
>
CV_EXPORTS
WCircle
Widget
::
cast
<
WCircle
>
();
template
<
>
CV_EXPORTS
WCone
Widget
::
cast
<
WCone
>
();
template
<
>
CV_EXPORTS
WCube
Widget
::
cast
<
WCube
>
();
template
<
>
CV_EXPORTS
WCoordinateSystem
Widget
::
cast
<
WCoordinateSystem
>
();
template
<
>
CV_EXPORTS
WPolyLine
Widget
::
cast
<
WPolyLine
>
();
...
...
modules/viz/src/precomp.hpp
浏览文件 @
bb891f05
...
...
@@ -127,6 +127,7 @@
#include <vtkTensorGlyph.h>
#include <vtkImageAlgorithm.h>
#include <vtkTransformFilter.h>
#include <vtkConeSource.h>
#include <vtkStreamingDemandDrivenPipeline.h>
#if !defined(_WIN32) || defined(__CYGWIN__)
...
...
modules/viz/src/shapes.cpp
浏览文件 @
bb891f05
...
...
@@ -253,6 +253,46 @@ template<> cv::viz::WCircle cv::viz::Widget::cast<cv::viz::WCircle>()
return
static_cast
<
WCircle
&>
(
widget
);
}
///////////////////////////////////////////////////////////////////////////////////////////////
/// WCone widget implementation
cv
::
viz
::
WCone
::
WCone
(
double
length
,
double
radius
,
int
resolution
,
const
Color
&
color
)
{
vtkSmartPointer
<
vtkConeSource
>
cone_source
=
vtkSmartPointer
<
vtkConeSource
>::
New
();
cone_source
->
SetCenter
(
length
*
0.5
,
0.0
,
0.0
);
cone_source
->
SetHeight
(
length
);
cone_source
->
SetRadius
(
radius
);
cone_source
->
SetResolution
(
resolution
);
cone_source
->
Update
();
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
VtkUtils
::
SetInputData
(
mapper
,
cone_source
->
GetOutput
());
vtkSmartPointer
<
vtkActor
>
actor
=
vtkSmartPointer
<
vtkActor
>::
New
();
actor
->
SetMapper
(
mapper
);
WidgetAccessor
::
setProp
(
*
this
,
actor
);
setColor
(
color
);
}
cv
::
viz
::
WCone
::
WCone
(
double
radius
,
const
Point3d
&
center
,
const
Point3d
&
tip
,
int
resolution
,
const
Color
&
color
)
{
Vec3d
arbitrary
=
get_random_vec
();
Vec3d
xvec
=
normalized
(
Vec3d
(
tip
-
center
));
Vec3d
zvec
=
normalized
(
xvec
.
cross
(
arbitrary
));
Vec3d
yvec
=
zvec
.
cross
(
xvec
);
WCone
circle
(
norm
(
tip
-
center
),
radius
,
resolution
,
color
);
circle
.
applyTransform
(
makeTransformToGlobal
(
xvec
,
yvec
,
zvec
,
center
));
*
this
=
circle
;
}
template
<
>
cv
::
viz
::
WCone
cv
::
viz
::
Widget
::
cast
<
cv
::
viz
::
WCone
>
()
{
Widget3D
widget
=
this
->
cast
<
Widget3D
>
();
return
static_cast
<
WCone
&>
(
widget
);
}
///////////////////////////////////////////////////////////////////////////////////////////////
/// cylinder widget implementation
...
...
modules/viz/test/tests_simple.cpp
浏览文件 @
bb891f05
...
...
@@ -299,6 +299,8 @@ TEST(Viz, show_simple_widgets)
viz
.
showWidget
(
"cir2"
,
WCircle
(
0.5
,
Point3d
(
0.5
,
0.0
,
0.0
),
Vec3d
(
1.0
,
0.0
,
0.0
),
0.01
,
Color
::
apricot
()));
viz
.
showWidget
(
"cyl0"
,
WCylinder
(
Vec3d
(
-
0.5
,
0.5
,
-
0.5
),
Vec3d
(
0.5
,
0.5
,
-
0.5
),
0.125
,
30
,
Color
::
brown
()));
viz
.
showWidget
(
"con0"
,
WCone
(
0.25
,
0.125
,
6
,
Color
::
azure
()));
viz
.
showWidget
(
"con1"
,
WCone
(
0.125
,
Point3d
(
0.5
,
-
0.5
,
0.5
),
Point3d
(
0.5
,
-
1.0
,
0.5
),
6
,
Color
::
turquoise
()));
viz
.
spin
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录