2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OpenCV3.0 Viz+VTK Creating Widgets (Visual Studio 2013, C++, OpenCV3.0)

Last updated at Posted at 2015-07-26

#VizチュートリアルのCreatingWidgetsを試してみました。

チュートリアルを参考にWidgetを増やして表示してみました。
showWidgetの名前を変えるだけです。
変更したmain部分だけ載せています。

#ソースコード

#include <opencv_vtk_lib.hpp>
int main()
{
	help();
	viz::Viz3d myWindow("Creating Widgets");
	WTriangle tw(Point3f(0.0, 0.0, 0.0), Point3f(1.0, 1.0, 1.0), Point3f(0.0, 1.0, 0.0), viz::Color::red());
	WTriangle tw2(Point3f(0.0, 0.0, 0.0), Point3f(1.0, 0.0, 1.0), Point3f(0.0, 1.0, 1.0), viz::Color::green());
	myWindow.showWidget("TRIANGLE", tw);
	myWindow.showWidget("TRIANGLE2", tw2);//名前を変えると追加できる
	myWindow.spin();

	return 0;
}

opencv_vtk_lib.hppの中身を以下のようにし、opencv300\build\includeの下に置く。

// ビルドモード
#ifdef _DEBUG
#define CV_VTK_EXT_STR "-gd.lib"
#else
#define CV_VTK_EXT_STR ".lib"
#endif

#pragma comment(lib, "LSDyna" CV_VTK_EXT_STR)
#pragma comment(lib, "MapReduceMPI" CV_VTK_EXT_STR)
#pragma comment(lib, "mpistubs" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkalglib" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkCharts" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkCommon" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkDICOMParser" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkexoIIc" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkexpat" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkFiltering" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkfreetype" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkftgl" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkGenericFiltering" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkGeovis" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkGraphics" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkhdf5" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkhdf5_hl" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkHybrid" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkImaging" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkInfovis" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkIO" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkjpeg" CV_VTK_EXT_STR)
#pragma comment(lib, "vtklibxml2" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkmetaio" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkNetCDF" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkpng" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkproj4" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkRendering" CV_VTK_EXT_STR)
#pragma comment(lib, "vtksqlite" CV_VTK_EXT_STR)
#pragma comment(lib, "vtksys" CV_VTK_EXT_STR)
#pragma comment(lib, "vtktiff" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkverdict" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkViews" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkVolumeRendering" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkWidgets" CV_VTK_EXT_STR)
#pragma comment(lib, "vtkzlib" CV_VTK_EXT_STR)

#開発環境

  • VisualStudio2013
  • OpenCV3.0
  • VTK 5.10 (PCL1.7.2)

#実行結果
Widgets.png

#参考文献
OpenCV3.0の導入方法はこちら
modulesのvizのincludeファイルはOpenCVのincludeディレクトリにコピペしておきましょう

#プロパティ設定
Additional Include Directories
$(OPENCV_DIR)\build\include;C:\Program Files (x86)\PCL 1.7.2\3rdParty\VTK\include\vtk-5.10;

Additional Library Directories
$(OPENCV_DIR)\build\x86\vc12\lib;C:\Program Files (x86)\PCL 1.7.2\3rdParty\VTK\lib\vtk-5.10;

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?