Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
c4a07b75
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,发现更多精彩内容 >>
提交
c4a07b75
编写于
6月 27, 2013
作者:
O
ozantonkal
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
createSphere and showSphere implementations
上级
17bdc29d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
61 addition
and
2 deletion
+61
-2
modules/viz/include/opencv2/viz/viz3d.hpp
modules/viz/include/opencv2/viz/viz3d.hpp
+1
-0
modules/viz/src/q/shapes.h
modules/viz/src/q/shapes.h
+1
-0
modules/viz/src/q/viz3d_impl.hpp
modules/viz/src/q/viz3d_impl.hpp
+2
-0
modules/viz/src/shapes.cpp
modules/viz/src/shapes.cpp
+13
-0
modules/viz/src/viz3d.cpp
modules/viz/src/viz3d.cpp
+5
-0
modules/viz/src/viz3d_impl.cpp
modules/viz/src/viz3d_impl.cpp
+36
-1
modules/viz/test/test_viz3d.cpp
modules/viz/test/test_viz3d.cpp
+3
-1
未找到文件。
modules/viz/include/opencv2/viz/viz3d.hpp
浏览文件 @
c4a07b75
...
...
@@ -38,6 +38,7 @@ namespace temp_viz
void
showCube
(
const
String
&
id
,
const
Point3f
&
pt1
,
const
Point3f
&
pt2
,
const
Color
&
color
=
Color
(
255
,
255
,
255
));
void
showCylinder
(
const
String
&
id
,
const
Point3f
&
pt_on_axis
,
const
Point3f
&
axis_direction
,
double
radius
,
int
num_sides
,
const
Color
&
color
=
Color
(
255
,
255
,
255
));
void
showCircle
(
const
String
&
id
,
const
Point3f
&
pt
,
double
radius
,
const
Color
&
color
=
Color
(
255
,
255
,
255
));
void
showSphere
(
const
String
&
id
,
const
Point3f
&
pt
,
double
radius
,
const
Color
&
color
=
Color
(
255
,
255
,
255
));
Affine3f
getShapePose
(
const
String
&
id
);
bool
setShapePose
(
const
String
&
id
,
const
Affine3f
&
pose
);
...
...
modules/viz/src/q/shapes.h
浏览文件 @
c4a07b75
...
...
@@ -13,6 +13,7 @@ namespace temp_viz
CV_EXPORTS
vtkSmartPointer
<
vtkDataSet
>
createPlane
(
const
Vec4f
&
coefs
,
const
Point3f
&
pt
);
CV_EXPORTS
vtkSmartPointer
<
vtkDataSet
>
create2DCircle
(
const
Point3f
&
pt
,
double
radius
);
CV_EXPORTS
vtkSmartPointer
<
vtkDataSet
>
createCube
(
const
Point3f
&
pt_min
,
const
Point3f
&
pt_max
);
CV_EXPORTS
vtkSmartPointer
<
vtkDataSet
>
createSphere
(
const
Point3f
&
pt
,
double
radius
);
// CV_EXPORTS vtkSmartPointer<vtkDataSet> createCube (const Point3f& pt, const Quaternionf& qt, );
// CV_EXPORTS vtkSmartPointer<vtkDataSet> createCube (const Eigen::Vector3f &translation, const Eigen::Quaternionf &rotation, double width, double height, double depth);
// CV_EXPORTS vtkSmartPointer<vtkDataSet> createCube (double x_min, double x_max, double y_min, double y_max, double z_min, double z_max);
...
...
modules/viz/src/q/viz3d_impl.hpp
浏览文件 @
c4a07b75
...
...
@@ -144,6 +144,8 @@ public:
void
showCube
(
const
String
&
id
,
const
Point3f
&
pt1
,
const
Point3f
&
pt2
,
const
Color
&
color
);
void
showCylinder
(
const
String
&
id
,
const
Point3f
&
pt_on_axis
,
const
Point3f
&
axis_direction
,
double
radius
,
int
num_sides
,
const
Color
&
color
);
void
showCircle
(
const
String
&
id
,
const
Point3f
&
pt
,
double
radius
,
const
Color
&
color
);
void
showSphere
(
const
String
&
id
,
const
Point3f
&
pt
,
double
radius
,
const
Color
&
color
);
Affine3f
getShapePose
(
const
String
&
id
);
bool
setShapePose
(
const
String
&
id
,
const
Affine3f
&
pose
);
...
...
modules/viz/src/shapes.cpp
浏览文件 @
c4a07b75
...
...
@@ -71,6 +71,19 @@ vtkSmartPointer<vtkDataSet> temp_viz::createCube(const cv::Point3f& pt_min, cons
return
(
cube
->
GetOutput
());
}
vtkSmartPointer
<
vtkDataSet
>
temp_viz
::
createSphere
(
const
Point3f
&
pt
,
double
radius
)
{
vtkSmartPointer
<
vtkSphereSource
>
sphere
=
vtkSmartPointer
<
vtkSphereSource
>::
New
();
sphere
->
SetRadius
(
radius
);
sphere
->
SetCenter
(
pt
.
x
,
pt
.
y
,
pt
.
z
);
sphere
->
SetPhiResolution
(
10
);
sphere
->
SetThetaResolution
(
10
);
sphere
->
LatLongTessellationOff
();
sphere
->
Update
();
return
(
sphere
->
GetOutput
());
}
////////////////////////////////////////////////////////////////////////////////////////////
vtkSmartPointer
<
vtkDataSet
>
temp_viz
::
createCylinder
(
const
temp_viz
::
ModelCoefficients
&
coefficients
,
int
numsides
)
{
...
...
modules/viz/src/viz3d.cpp
浏览文件 @
c4a07b75
...
...
@@ -108,6 +108,11 @@ void temp_viz::Viz3d::showCircle(const String &id, const Point3f &pt, double rad
impl_
->
showCircle
(
id
,
pt
,
radius
,
color
);
}
void
temp_viz
::
Viz3d
::
showSphere
(
const
String
&
id
,
const
Point3f
&
pt
,
double
radius
,
const
Color
&
color
)
{
impl_
->
showSphere
(
id
,
pt
,
radius
,
color
);
}
cv
::
Affine3f
temp_viz
::
Viz3d
::
getShapePose
(
const
String
&
id
)
{
return
impl_
->
getShapePose
(
id
);
...
...
modules/viz/src/viz3d_impl.cpp
浏览文件 @
c4a07b75
...
...
@@ -477,6 +477,41 @@ void temp_viz::Viz3d::VizImpl::showCircle (const String &id, const Point3f &pt,
}
}
void
temp_viz
::
Viz3d
::
VizImpl
::
showSphere
(
const
String
&
id
,
const
Point3f
&
pt
,
double
radius
,
const
Color
&
color
)
{
// Check if this Id already exists
ShapeActorMap
::
iterator
am_it
=
shape_actor_map_
->
find
(
id
);
bool
exists
=
(
am_it
!=
shape_actor_map_
->
end
());
Color
c
=
vtkcolor
(
color
);
// If it exists just update
if
(
exists
)
{
vtkSmartPointer
<
vtkLODActor
>
actor
=
vtkLODActor
::
SafeDownCast
(
am_it
->
second
);
reinterpret_cast
<
vtkDataSetMapper
*>
(
actor
->
GetMapper
())
->
SetInput
(
createSphere
(
pt
,
radius
));
actor
->
GetProperty
()
->
SetColor
(
c
.
val
);
actor
->
GetMapper
()
->
ScalarVisibilityOff
();
actor
->
Modified
();
}
else
{
// Create a plane
vtkSmartPointer
<
vtkDataSet
>
data
=
createSphere
(
pt
,
radius
);
// Create an Actor
vtkSmartPointer
<
vtkLODActor
>
actor
;
createActorFromVTKDataSet
(
data
,
actor
);
// actor->GetProperty ()->SetRepresentationToWireframe ();
actor
->
GetProperty
()
->
SetRepresentationToSurface
();
actor
->
GetProperty
()
->
SetLighting
(
false
);
actor
->
GetProperty
()
->
SetColor
(
c
.
val
);
actor
->
GetMapper
()
->
ScalarVisibilityOff
();
renderer_
->
AddActor
(
actor
);
// Save the pointer/ID pair to the global actor map
(
*
shape_actor_map_
)[
id
]
=
actor
;
}
}
cv
::
Affine3f
temp_viz
::
Viz3d
::
VizImpl
::
getShapePose
(
const
String
&
id
)
{
// Get the shape with the id and return the pose
...
...
@@ -485,7 +520,7 @@ cv::Affine3f temp_viz::Viz3d::VizImpl::getShapePose (const String &id)
if
(
!
exists
)
{
std
::
cout
<<
"[getShapePose] A shape with id
"
<<
id
<<
"
does not exist!"
<<
std
::
endl
;
std
::
cout
<<
"[getShapePose] A shape with id
<"
<<
id
<<
">
does not exist!"
<<
std
::
endl
;
return
Affine3f
();
}
...
...
modules/viz/test/test_viz3d.cpp
浏览文件 @
c4a07b75
...
...
@@ -92,7 +92,8 @@ TEST(Viz_viz3d, accuracy)
int
col_blue
=
0
;
int
col_green
=
0
;
int
col_red
=
0
;
v
.
showCircle
(
"circle1"
,
cv
::
Point3f
(
0
,
0
,
0
),
fabs
(
1.0
f
),
temp_viz
::
Color
(
0
,
255
,
0
));
v
.
showCircle
(
"circle1"
,
cv
::
Point3f
(
0
,
0
,
0
),
1.0
,
temp_viz
::
Color
(
0
,
255
,
0
));
v
.
showSphere
(
"sphere1"
,
cv
::
Point3f
(
0
,
0
,
0
),
0.5
,
temp_viz
::
Color
(
0
,
0
,
255
));
while
(
!
v
.
wasStopped
())
{
...
...
@@ -107,6 +108,7 @@ TEST(Viz_viz3d, accuracy)
// v.showCube("cube1", cv::Point3f(pos_x, pos_y, pos_z), cv::Point3f(pos_x+0.5, pos_y+0.5, pos_z+0.5), temp_viz::Color(255,150,50));
// v.showCylinder("cylinder1", cv::Point3f(0,0,0), cv::Point3f(pos_x, 1.0, 1.0), 0.5, 5*pos_x+3, temp_viz::Color(0,255,0));
v
.
setShapePose
(
"circle1"
,
cloudPosition
);
v
.
setShapePose
(
"sphere1"
,
cloudPosition
);
angle_x
+=
0.1
f
;
angle_y
-=
0.1
f
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录