Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
8d327fa4
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,发现更多精彩内容 >>
提交
8d327fa4
编写于
1月 13, 2014
作者:
A
Anatoly Baksheev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
updated for compatibility with VTK6.0
上级
e472d45d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
45 addition
and
18 deletion
+45
-18
cmake/OpenCVDetectVTK.cmake
cmake/OpenCVDetectVTK.cmake
+2
-2
modules/viz/src/clouds.cpp
modules/viz/src/clouds.cpp
+2
-2
modules/viz/src/precomp.hpp
modules/viz/src/precomp.hpp
+27
-1
modules/viz/src/shapes.cpp
modules/viz/src/shapes.cpp
+12
-12
modules/viz/src/widget.cpp
modules/viz/src/widget.cpp
+1
-0
modules/viz/test/tests_simple.cpp
modules/viz/test/tests_simple.cpp
+1
-1
未找到文件。
cmake/OpenCVDetectVTK.cmake
浏览文件 @
8d327fa4
...
...
@@ -2,7 +2,7 @@ if(NOT WITH_VTK OR ANDROID OR IOS)
return
()
endif
()
find_package
(
VTK 6.0 QUIET COMPONENTS vtkRenderingCore vtkInteractionWidgets vtkInteractionStyle vtkIOLegacy vtkIOPLY vtkRenderingFreeType vtkRenderingLOD vtkFiltersTexture NO_MODULE
)
find_package
(
VTK 6.0 QUIET COMPONENTS vtkRenderingCore vtkInteractionWidgets vtkInteractionStyle vtkIOLegacy vtkIOPLY vtkRenderingFreeType vtkRenderingLOD vtkFiltersTexture
vtkIOExport
NO_MODULE
)
if
(
NOT DEFINED VTK_FOUND OR NOT VTK_FOUND
)
find_package
(
VTK 5.10 QUIET COMPONENTS vtkCommon vtkFiltering vtkRendering vtkWidgets vtkImaging NO_MODULE
)
...
...
@@ -18,4 +18,4 @@ if(VTK_FOUND)
else
()
set
(
HAVE_VTK OFF
)
message
(
STATUS
"VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or set $VTK_DIR enviroment variable to VTK install subdirectory with VTKConfig.cmake file (for windows)"
)
endif
()
\ No newline at end of file
endif
()
modules/viz/src/clouds.cpp
浏览文件 @
8d327fa4
...
...
@@ -230,8 +230,8 @@ void cv::viz::WCloudCollection::addCloud(InputArray cloud, InputArray colors, co
CV_Assert
(
"Cloud Widget without data"
&&
currdata
);
vtkSmartPointer
<
vtkAppendPolyData
>
append_filter
=
vtkSmartPointer
<
vtkAppendPolyData
>::
New
();
append_filter
->
AddInputConnection
(
currdata
->
GetProducerPort
()
);
append_filter
->
AddInputConnection
(
polydata
->
GetProducerPort
()
);
VtkUtils
::
AddInputData
(
append_filter
,
currdata
);
VtkUtils
::
AddInputData
(
append_filter
,
polydata
);
append_filter
->
Update
();
VtkUtils
::
SetInputData
(
mapper
,
append_filter
->
GetOutput
());
...
...
modules/viz/src/precomp.hpp
浏览文件 @
8d327fa4
...
...
@@ -230,6 +230,25 @@ namespace cv
filter
->
SetInputData
(
polydata
);
#endif
}
template
<
class
Filter
>
static
void
SetSourceData
(
vtkSmartPointer
<
Filter
>
filter
,
vtkPolyData
*
polydata
)
{
#if VTK_MAJOR_VERSION <= 5
filter
->
SetSource
(
polydata
);
#else
filter
->
SetSourceData
(
polydata
);
#endif
}
template
<
class
Filter
>
static
void
SetInputData
(
vtkSmartPointer
<
Filter
>
filter
,
vtkImageData
*
polydata
)
{
#if VTK_MAJOR_VERSION <= 5
filter
->
SetInput
(
polydata
);
#else
filter
->
SetInputData
(
polydata
);
#endif
}
template
<
class
Filter
>
static
void
AddInputData
(
vtkSmartPointer
<
Filter
>
filter
,
vtkPolyData
*
polydata
)
...
...
@@ -285,7 +304,14 @@ namespace cv
static
vtkSmartPointer
<
vtkPolyData
>
TransformPolydata
(
vtkSmartPointer
<
vtkPolyData
>
polydata
,
const
Affine3d
&
pose
)
{
return
TransformPolydata
(
polydata
->
GetProducerPort
(),
pose
);
vtkSmartPointer
<
vtkTransform
>
transform
=
vtkSmartPointer
<
vtkTransform
>::
New
();
transform
->
SetMatrix
(
vtkmatrix
(
pose
.
matrix
));
vtkSmartPointer
<
vtkTransformPolyDataFilter
>
transform_filter
=
vtkSmartPointer
<
vtkTransformPolyDataFilter
>::
New
();
VtkUtils
::
SetInputData
(
transform_filter
,
polydata
);
transform_filter
->
SetTransform
(
transform
);
transform_filter
->
Update
();
return
transform_filter
->
GetOutput
();
}
};
}
...
...
modules/viz/src/shapes.cpp
浏览文件 @
8d327fa4
...
...
@@ -355,7 +355,7 @@ cv::viz::WCoordinateSystem::WCoordinateSystem(double scale)
polydata
->
GetPointData
()
->
SetScalars
(
colors
);
vtkSmartPointer
<
vtkTubeFilter
>
tube_filter
=
vtkSmartPointer
<
vtkTubeFilter
>::
New
();
tube_filter
->
SetInputConnection
(
polydata
->
GetProducerPort
()
);
VtkUtils
::
SetInputData
(
tube_filter
,
polydata
);
tube_filter
->
SetRadius
(
axes
->
GetScaleFactor
()
/
50.0
);
tube_filter
->
SetNumberOfSides
(
6
);
tube_filter
->
Update
();
...
...
@@ -447,7 +447,7 @@ cv::viz::WGrid::WGrid(const Vec2i &cells, const Vec2d &cells_spacing, const Colo
// Extract the edges so we have the grid
vtkSmartPointer
<
vtkExtractEdges
>
extract_edges
=
vtkSmartPointer
<
vtkExtractEdges
>::
New
();
extract_edges
->
SetInputConnection
(
grid_data
->
GetProducerPort
()
);
VtkUtils
::
SetInputData
(
extract_edges
,
grid_data
);
extract_edges
->
Update
();
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
...
...
@@ -854,13 +854,13 @@ cv::viz::WCameraPosition::WCameraPosition(const Matx33d &K, InputArray _image, d
// Frustum needs to be textured or else it can't be combined with image
vtkSmartPointer
<
vtkTextureMapToPlane
>
frustum_texture
=
vtkSmartPointer
<
vtkTextureMapToPlane
>::
New
();
frustum_texture
->
SetInputConnection
(
frustum
->
GetProducerPort
()
);
VtkUtils
::
SetInputData
(
frustum_texture
,
frustum
);
frustum_texture
->
SetSRange
(
0.0
,
0.0
);
// Texture mapping with only one pixel
frustum_texture
->
SetTRange
(
0.0
,
0.0
);
// from the image to have constant color
vtkSmartPointer
<
vtkAppendPolyData
>
append_filter
=
vtkSmartPointer
<
vtkAppendPolyData
>::
New
();
append_filter
->
AddInputConnection
(
frustum_texture
->
GetOutputPort
());
append_filter
->
AddInputConnection
(
plane
->
GetProducerPort
()
);
VtkUtils
::
AddInputData
(
append_filter
,
plane
);
vtkSmartPointer
<
vtkActor
>
actor
=
getActor
(
image_widget
);
actor
->
GetMapper
()
->
SetInputConnection
(
append_filter
->
GetOutputPort
());
...
...
@@ -886,13 +886,13 @@ cv::viz::WCameraPosition::WCameraPosition(const Vec2d &fov, InputArray _image, d
// Frustum needs to be textured or else it can't be combined with image
vtkSmartPointer
<
vtkTextureMapToPlane
>
frustum_texture
=
vtkSmartPointer
<
vtkTextureMapToPlane
>::
New
();
frustum_texture
->
SetInputConnection
(
frustum
->
GetProducerPort
()
);
VtkUtils
::
SetInputData
(
frustum_texture
,
frustum
);
frustum_texture
->
SetSRange
(
0.0
,
0.0
);
// Texture mapping with only one pixel
frustum_texture
->
SetTRange
(
0.0
,
0.0
);
// from the image to have constant color
vtkSmartPointer
<
vtkAppendPolyData
>
append_filter
=
vtkSmartPointer
<
vtkAppendPolyData
>::
New
();
append_filter
->
AddInputConnection
(
frustum_texture
->
GetOutputPort
());
append_filter
->
AddInputConnection
(
plane
->
GetProducerPort
()
);
VtkUtils
::
AddInputData
(
append_filter
,
plane
);
vtkSmartPointer
<
vtkActor
>
actor
=
getActor
(
image_widget
);
actor
->
GetMapper
()
->
SetInputConnection
(
append_filter
->
GetOutputPort
());
...
...
@@ -917,7 +917,7 @@ cv::viz::WTrajectory::WTrajectory(InputArray _path, int display_mode, double sca
{
Mat
points
=
vtkTrajectorySource
::
ExtractPoints
(
_path
);
vtkSmartPointer
<
vtkPolyData
>
polydata
=
getPolyData
(
WPolyLine
(
points
,
color
));
append_filter
->
AddInputConnection
(
polydata
->
GetProducerPort
()
);
VtkUtils
::
AddInputData
(
append_filter
,
polydata
);
}
if
(
display_mode
&
WTrajectory
::
FRAMES
)
...
...
@@ -929,7 +929,7 @@ cv::viz::WTrajectory::WTrajectory(InputArray _path, int display_mode, double sca
vtkSmartPointer
<
vtkTensorGlyph
>
tensor_glyph
=
vtkSmartPointer
<
vtkTensorGlyph
>::
New
();
tensor_glyph
->
SetInputConnection
(
source
->
GetOutputPort
());
tensor_glyph
->
SetSourceConnection
(
glyph
->
GetProducerPort
()
);
VtkUtils
::
SetSourceData
(
tensor_glyph
,
glyph
);
tensor_glyph
->
ExtractEigenvaluesOff
();
// Treat as a rotation matrix, not as something with eigenvalues
tensor_glyph
->
ThreeGlyphsOff
();
tensor_glyph
->
SymmetricOff
();
...
...
@@ -968,7 +968,7 @@ cv::viz::WTrajectoryFrustums::WTrajectoryFrustums(InputArray _path, const Matx33
vtkSmartPointer
<
vtkTensorGlyph
>
tensor_glyph
=
vtkSmartPointer
<
vtkTensorGlyph
>::
New
();
tensor_glyph
->
SetInputConnection
(
source
->
GetOutputPort
());
tensor_glyph
->
SetSourceConnection
(
glyph
->
GetProducerPort
()
);
VtkUtils
::
SetSourceData
(
tensor_glyph
,
glyph
);
tensor_glyph
->
ExtractEigenvaluesOff
();
// Treat as a rotation matrix, not as something with eigenvalues
tensor_glyph
->
ThreeGlyphsOff
();
tensor_glyph
->
SymmetricOff
();
...
...
@@ -994,7 +994,7 @@ cv::viz::WTrajectoryFrustums::WTrajectoryFrustums(InputArray _path, const Vec2d
vtkSmartPointer
<
vtkTensorGlyph
>
tensor_glyph
=
vtkSmartPointer
<
vtkTensorGlyph
>::
New
();
tensor_glyph
->
SetInputConnection
(
source
->
GetOutputPort
());
tensor_glyph
->
SetSourceConnection
(
glyph
->
GetProducerPort
()
);
VtkUtils
::
SetSourceData
(
tensor_glyph
,
glyph
);
tensor_glyph
->
ExtractEigenvaluesOff
();
// Treat as a rotation matrix, not as something with eigenvalues
tensor_glyph
->
ThreeGlyphsOff
();
tensor_glyph
->
SymmetricOff
();
...
...
@@ -1046,7 +1046,7 @@ cv::viz::WTrajectorySpheres::WTrajectorySpheres(InputArray _path, double line_le
vtkSmartPointer
<
vtkPolyData
>
polydata
=
sphere_source
->
GetOutput
();
polydata
->
GetCellData
()
->
SetScalars
(
VtkUtils
::
FillScalars
(
polydata
->
GetNumberOfCells
(),
c
));
append_filter
->
AddInputConnection
(
polydata
->
GetProducerPort
()
);
VtkUtils
::
AddInputData
(
append_filter
,
polydata
);
if
(
i
>
0
)
{
...
...
@@ -1064,7 +1064,7 @@ cv::viz::WTrajectorySpheres::WTrajectorySpheres(InputArray _path, double line_le
line_source
->
Update
();
vtkSmartPointer
<
vtkPolyData
>
polydata
=
line_source
->
GetOutput
();
polydata
->
GetCellData
()
->
SetScalars
(
VtkUtils
::
FillScalars
(
polydata
->
GetNumberOfCells
(),
c
));
append_filter
->
AddInputConnection
(
polydata
->
GetProducerPort
()
);
VtkUtils
::
AddInputData
(
append_filter
,
polydata
);
}
}
append_filter
->
Update
();
...
...
modules/viz/src/widget.cpp
浏览文件 @
8d327fa4
...
...
@@ -276,6 +276,7 @@ void cv::viz::Widget3D::applyTransform(const Affine3d &transform)
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkPolyDataMapper
::
SafeDownCast
(
actor
->
GetMapper
());
CV_Assert
(
"Widget doesn't have a polydata mapper"
&&
mapper
);
mapper
->
Update
();
VtkUtils
::
SetInputData
(
mapper
,
VtkUtils
::
TransformPolydata
(
mapper
->
GetInput
(),
transform
));
}
...
...
modules/viz/test/tests_simple.cpp
浏览文件 @
8d327fa4
...
...
@@ -113,7 +113,7 @@ TEST(Viz, show_painted_clouds)
viz
.
setBackgroundMeshLab
();
viz
.
showWidget
(
"coosys"
,
WCoordinateSystem
());
viz
.
showWidget
(
"cloud1"
,
WPaintedCloud
(
cloud
),
Affine3d
(
Vec3d
(
0.0
,
-
CV_PI
/
2
,
0.0
),
Vec3d
(
-
1.5
,
0.0
,
0.0
)));
viz
.
showWidget
(
"cloud2"
,
WPaintedCloud
(
cloud
,
Vec3d
(
0.0
,
0.0
,
-
1.0
),
Vec3d
(
0.0
,
0.0
,
1
.0
)),
Affine3d
(
Vec3d
(
0.0
,
CV_PI
/
2
,
0.0
),
Vec3d
(
1.5
,
0.0
,
0.0
)));
viz
.
showWidget
(
"cloud2"
,
WPaintedCloud
(
cloud
,
Vec3d
(
0.0
,
-
0.75
,
-
1.0
),
Vec3d
(
0.0
,
0.75
,
0
.0
)),
Affine3d
(
Vec3d
(
0.0
,
CV_PI
/
2
,
0.0
),
Vec3d
(
1.5
,
0.0
,
0.0
)));
viz
.
showWidget
(
"cloud3"
,
WPaintedCloud
(
cloud
,
Vec3d
(
0.0
,
0.0
,
-
1.0
),
Vec3d
(
0.0
,
0.0
,
1.0
),
Color
::
blue
(),
Color
::
red
()));
viz
.
showWidget
(
"arrow"
,
WArrow
(
Vec3d
(
0.0
,
1.0
,
-
1.0
),
Vec3d
(
0.0
,
1.0
,
1.0
),
0.009
,
Color
::
raspberry
()));
viz
.
spin
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录