Windowsにchainer 1.5.1を入れる
chainerを1.3.2から1.5.1にバージョンアップしようとしたら、エラーになった。
Install packages failed: Error occurred when installing package chainer. The following command was executed: packaging_tool.py install --build-dir C:\Users\aaaaaa\AppData\Local\Temp\pycharm-packaging53071042397457997.tmp chainer==1.5.1 The error output of the command: Command "C:\Python2710\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\aaaaaa\\AppData\\Local\\Temp\\pycharm-packaging53071042397457997.tmp\\h5py\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\aaaaaa\appdata\local\temp\pip-f1jf9i-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\aaaaaa\AppData\Local\Temp\pycharm-packaging53071042397457997.tmp\h5py Collecting chainer==1.5.1 Downloading chainer-1.5.1.tar.gz (864kB) Requirement already satisfied (use --upgrade to upgrade): filelock in c:\python2710\lib\site-packages (from chainer==1.5.1) Requirement already satisfied (use --upgrade to upgrade): nose in c:\python2710\lib\site-packages (from chainer==1.5.1) Requirement already satisfied (use --upgrade to upgrade): numpy>=1.9.0 in c:\python2710\lib\site-packages (from chainer==1.5.1) Requirement already satisfied (use --upgrade to upgrade): protobuf in c:\python2710\lib\site-packages (from chainer==1.5.1) Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in c:\python2710\lib\site-packages (from chainer==1.5.1) Collecting h5py>=2.5.0 (from chainer==1.5.1) Downloading h5py-2.5.0.tar.gz (684kB) Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\python2710\lib\site-packages (from protobuf->chainer==1.5.1) Collecting Cython>=0.17 (from h5py>=2.5.0->chainer==1.5.1) Downloading Cython-0.23.4-cp27-none-win_amd64.whl (1.8MB) Installing collected packages: Cython, h5py, chainer Running setup.py install for h5py 略 C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DH5_USE_16_API -D_HDF5USEDLL_ -IC:\Users\aaaaaa\AppData\Local\Temp\pycharm-packaging53071042397457997.tmp\h5py\lzf -IC:\Users\aaaaaa\AppData\Local\Temp\pycharm-packaging53071042397457997.tmp\h5py\windows -IC:\Python2710\lib\site-packages\numpy\core\include -IC:\Python2710\include -IC:\Python2710\PC /TcC:\Users\aaaaaa\AppData\Local\Temp\pycharm-packaging53071042397457997.tmp\h5py\h5py\defs.c /Fobuild\temp.win-amd64-2.7\Release\Users\aaaaaa\AppData\Local\Temp\pycharm-packaging53071042397457997.tmp\h5py\h5py\defs.obj defs.c c:\python2710\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION c:\users\aaaaaa\appdata\local\temp\pycharm-packaging53071042397457997.tmp\h5py\h5py\api_compat.h(27) : fatal error C1083: Cannot open include file: 'hdf5.h': No such file or directory Autodetection skipped [[Error 126] 指定されたモジュールが見つかりません。] error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2
Cython
Cythonのインストールでエラーになっているかと思ったら違った。。
h5pyというもののインストールでエラーになっていた。
WindowsでもCythonを使えるようにする。 - Qiita
http://www.lfd.uci.edu/~gohlke/pythonlibs/#cython
pip install Cython-0.23.4-cp27-none-win_amd64.whl
h5py
http://www.lfd.uci.edu/~gohlke/pythonlibs/#h5py
pip install h5py-2.5.0-cp27-none-win_amd64.whl
numpyインストール(ダメな手順)
_configtest.exe.manifest : general error c1010070: Failed to load and parse the manifest. ?????????????????? failure. removing: _configtest.c _configtest.obj Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\aaaaaa\AppData\Local\Temp\pycharm-packaging6190809776945737532.tmp\numpy\setup.py", line 263, in <module> setup_package() ... File "numpy\core\setup.py", line 669, in get_mathlib_info raise RuntimeError("Broken toolchain: cannot link a simple C program") RuntimeError: Broken toolchain: cannot link a simple C program
※この方法はダメだった。
sourceforge.netにあるインストーラーは、32bit版numpyが入ってchainerを入れるときにエラーになる。
Numerical Python - Browse /NumPy/1.10.2 at SourceForge.net
numpy-1.10.2-win32-superpack-python2.7.exe
を入れようとしたら、インストール先フォルダが違う。選択できない。
registryの
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath
の値を
C:\Python27\
から
C:\Python2710\
に変えたら、インストールしたいフォルダに変わった。
numpyインストール
http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
コマンドラインで、ダウンロードしたフォルダに移動して以下を実行。
pip install "numpy-1.10.2+mkl-cp27-none-win_amd64.whl"
エラー
Upgrade packages failed. The following command was executed: packaging_tool.py install --build-dir C:\Users\aaaaaa\AppData\Local\Temp\pycharm-packaging3546373645558497351.tmp -U chainer The error output of the command: Command "python setup.py egg_info" failed with error code 1 in C:\Users\aaaaaa\AppData\Local\Temp\pycharm-packaging3546373645558497351.tmp\chainer Collecting chainer Using cached chainer-1.5.1.tar.gz Complete output from command python setup.py egg_info: running egg_info creating pip-egg-info\chainer.egg-info writing requirements to pip-egg-info\chainer.egg-info\requires.txt writing pip-egg-info\chainer.egg-info\PKG-INFO writing top-level names to pip-egg-info\chainer.egg-info\top_level.txt writing dependency_links to pip-egg-info\chainer.egg-info\dependency_links.txt writing manifest file 'pip-egg-info\chainer.egg-info\SOURCES.txt' warning: manifest_maker: standard file '-c' not found Executing cythonize Options: {'profile': False, 'annotate': False, 'linetrace': False, 'no_cuda': False} Traceback (most recent call last): File "<string>", line 20, in <module> File "C:\Users\aaaaaa\AppData\Local\Temp\pycharm-packaging3546373645558497351.tmp\chainer\setup.py", line 87, in <module> 'build_ext': chainer_setup_build.chainer_build_ext, File "C:\Python2710\lib\distutils\core.py", line 151, in setup dist.run_commands() File "C:\Python2710\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "C:\Python2710\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "<string>", line 15, in replacement_run File "C:\Python2710\lib\site-packages\setuptools\command\egg_info.py", line 207, in find_sources mm.run() File "C:\Python2710\lib\site-packages\setuptools\command\egg_info.py", line 291, in run self.add_defaults() File "C:\Python2710\lib\site-packages\setuptools\command\egg_info.py", line 320, in add_defaults sdist.add_defaults(self) File "C:\Python2710\lib\site-packages\setuptools\command\sdist.py", line 130, in add_defaults build_ext = self.get_finalized_command('build_ext') File "C:\Python2710\lib\distutils\cmd.py", line 312, in get_finalized_command cmd_obj.ensure_finalized() File "C:\Python2710\lib\distutils\cmd.py", line 109, in ensure_finalized self.finalize_options() File "chainer_setup_build.py", line 319, in finalize_options extensions = make_extensions(_arg_options, compiler) File "chainer_setup_build.py", line 180, in make_extensions import numpy File "C:\Python2710\lib\site-packages\numpy\__init__.py", line 180, in <module> from . import add_newdocs File "C:\Python2710\lib\site-packages\numpy\add_newdocs.py", line 13, in <module> from numpy.lib import add_newdoc File "C:\Python2710\lib\site-packages\numpy\lib\__init__.py", line 8, in <module> from .type_check import * File "C:\Python2710\lib\site-packages\numpy\lib\type_check.py", line 11, in <module> import numpy.core.numeric as _nx File "C:\Python2710\lib\site-packages\numpy\core\__init__.py", line 14, in <module> from . import multiarray ImportError: DLL load failed: %1 は有効な Win32 アプリケーションではありません。 ----------------------------------------
原因は、32bitのnumpyをインストールしたことだった。
numpy-1.10.2+mkl-cp27-none-win_amd64.whl
でnumpyを入れて、pipでchainerを入れたら、
1.5.1になった。
エラーは出なかったけど、cuDNNというものを入れないと
chainerのコードが警告が出て正しく動かないのかもしれない。
cuDNNを入れた時のメモ。
http://kubotti.hatenablog.com/entry/2015/12/27/154500
Apacheのエラーログファイルから特定の文字列を検索
14:33:09 という文字を検索
sudo find /etc/httpd/logs/ -name '*error*' -type f -print | xargs sudo grep '14:33:09'
sudoが要らない場合
find /etc/httpd/logs/ -name '*error*' -type f -print | xargs grep '14:33:09'
/etc/httpd/logs/
の中の、
ファイル名にerrorが含まれるファイルから、'14:33:09'を検索。
参考にしたページ
PCL Kinect Fusion その1
『KINECT for Windows SDKプログラミングKinect for Windows v2センサー対応版』
の320ページ、7.1.3(Kinect Fusion関連のやつ)を試そうと思った、、けど、
まずは検索でヒットしたqiitaの記事を試した時のメモ。
Kinect v2のKinectFusionから色付きの3次元点群と自己位置を得る方法(Visual Studio 2013, OpenCV, C++, Kinect v2) - Qiita
手順
自分で書いたメモを見つつ、Visual Studio 2013でサンプルプロジェクト作成。
Point Cloud Libraryのインストールと設定 - kubotti’s memo
Point Cloud Libraryのビューワーでkinectのデータを表示 - kubotti’s memo
プロジェクト名は、PclFusion1とかPclFusion2にした。
https://github.com/UnaNancyOwen/Kinect2Sample/tree/master/Sample/Fusion
にある、
Fusion.cpp
KinectFusionHelper.cpp
KinectFusionHelper.h
を自分のVSプロジェクトにコピペ。
エラーその1
cannot open source file opencv2/opencv.hpp
Solution Explorerで、PclViewerSample1(プロジェクト名)を右クリック。
Release Property Pagesの
Configuration: で、All Configurations を選択。
Configuration Properties > C/C++ > General > Additional Include Directories
で、
C:\opencv\build\include
を追加。
エラーその2
Error 1 error LNK1181: cannot open input file 'C:\Program Files\Microsoft SDKs\Kinect\v2.0_1409\\lib\x64.obj'
Configuration Properties > Linker > Input > Additional Dependencies
で、
$(KINECTSDK20_DIR)\lib\x64
を追加するとこのエラーが出るようになる。
Configuration Properties > Linker > General > Additional Library Directories
に追加すべき、
$(KINECTSDK20_DIR)\lib\x64
を
Configuration Properties > Linker > Input > Additional Dependencies
に追加していたのが原因だった。
Configuration Properties > Linker > General > Additional Library Directories
に
Kinect20.lib
を間違って追加していた。
エラーその3
Error 1 error LNK2001: unresolved external symbol "public: void __cdecl cv::Mat::create(int,int const *,int)" (?create@Mat@cv@@QEAAXHPEBHH@Z)
OpenCVの設定が足りなかった。
c++ - error LNK2019: unresolved external symbol opencv - Stack Overflow
エラーその4
error lnk1181: cannot open input file opencv_core246d.lib
StackOverflowからコピーしたファイル名が自分のPCのファイル名と違っていた。(246dじゃなくて249d)
opencv_core249d.lib opencv_imgproc249d.lib opencv_highgui249d.lib opencv_ml249d.lib opencv_video249d.lib opencv_features2d249d.lib opencv_calib3d249d.lib opencv_objdetect249d.lib opencv_contrib249d.lib opencv_legacy249d.lib opencv_flann249d.lib
エラーその5
Error 1 error LNK2001: unresolved external symbol GetDefaultKinectSensor Error 2 error LNK2001: unresolved external symbol __imp_NuiFusionCreateReconstruction Error 3 error LNK2001: unresolved external symbol __imp_NuiFusionCreateImageFrame Error 4 error LNK2001: unresolved external symbol __imp_NuiFusionShadePointCloud Error 5 error LNK2001: unresolved external symbol __imp_NuiFusionReleaseImageFrame Error 6 error LNK1120: 5 unresolved externals
Configuration Properties > Linker > Input > Additional Dependencies
で、
Kinect20.lib
以外に
Kinect20.Fusion.lib
を足したら、エラー解消。
エラーその6
実行したら、以下のエラー。
コンピューターに Kinect20.Fusion.dll がないため、プログラムを開始できません。この問題を解決するには、プログラムを再インストールしてみてください。
システム環境変数に、
C:\Program Files\Microsoft SDKs\Kinect\v2.0_1409\bin
を足した。
エラーその7
実行したら途中でエラー。
Unhandled exception at 0x00007FFAACCDD48E (opencv_highgui249d.dll) in PclFusion2.exe: 0xC0000005: Access violation reading location 0x00000000402C0062.
c++ - OpenCV 2.2 VS2010 - Get an "Access violation reading" in a very simple code - Stack Overflow
the solution is to use libraries with 'd' suffix such as "opencv_core244d.lib" for debug, and use normal libraries such as "opencv_core244.lib" for release. it just works. Good luck
OpenCV関連の.libで249dのdを取ったら、エラー解消。
opencv_core249.lib opencv_imgproc249.lib opencv_highgui249.lib opencv_ml249.lib opencv_video249.lib opencv_features2d249.lib opencv_calib3d249.lib opencv_objdetect249.lib opencv_contrib249.lib opencv_legacy249.lib opencv_flann249.lib
画面が表示された!
キャプチャ画像
dockerコンテナに外部からアクセスできるIPアドレスを割り当てる(CentOS 7)
dockerコンテナに外部からアクセスできるIPアドレスを割り当てる - kubotti’s memo
でCentOS6でやったことをCentOS7でもやってみる。
環境
ホストOS:Ubuntu 10.04.4 LTS
VM:KVM
$ virsh version Compiled against library: libvir 0.7.5 Using library: libvir 0.7.5 Using API: QEMU 0.7.5 Running hypervisor: QEMU 0.12.3
VMのネットワーク接続方法:後で調べる。たぶん仮想ブリッジ。
ゲストOS:CentOS Linux release 7.1.1503 (Core)
ゲストOSに入れたdocker:Docker version 1.8.2, build bb472f0/1.8.2
ゲストOSのIPアドレスは、192.168.3.57
ホストOSのIPアドレスは、特に関係ないけど、192.168.2.40
この環境で、192.168.2.0/23の他のPCからアクセス可能なdockerコンテナを作る。
※サブネットマスクが23なので、255.255.254.0のネットワーク。(192.168.2.0 - 192.168.3.255まで)
IPアドレスを192.168.3.58にする、というか、iptablesのNAT機能で転送する。
docker imageの取得
ゲストOS(CentOS)で実行
docker pull centos:centos6
立ち上げ
docker run -d -it -p 50022:22 --hostname webapp1 --name webapp1 centos:centos6 /bin/bash
2回目以降のコンテナの立ち上げ
docker ps -a
で停止中の一覧を取得して、
docker start webapp1
で起動。
コンテナ上のCentOSに最低限のソフトウェアをインストール
docker attach webapp1
コンテナ内のCentOSで実行
yum install wget
cd mkdir rpm cd rpm wget http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm
yum install initscripts yum install openssh-server service sshd start
yum install passwd yum install openssh-clients cd /etc/ssh/ cp sshd_config sshd_config.20151106
vi sshd_config
# add PermitRootLogin yes # change UsePAM no #UsePAM yes
service sshd start
rootのパスワード設定。
passwd
dockerのホストからsshできるか確認。
ssh root@172.17.0.1
デタッチ
How do you attach and detach from Docker's process? - Stack Overflow
Ctrl + p
Ctrl + q
でdockerコンテナを終了させずにデタッチ。
ネットワーク設定
KVM上のCentOS7(dockerホスト)上で、以下のコマンドを実行。
firewall-cmd --permanent --direct --add-rule ipv4 nat PREROUTING_direct 0 -d 192.168.3.58 -j DNAT --to 172.17.0.1 firewall-cmd --permanent --direct --add-rule ipv4 filter DOCKER 0 -d 172.17.0.1 -p 80 -j ACCEPT ip addr add 192.168.3.58/23 brd 192.168.3.255 dev eth0 #iptables -A DOCKER -d 172.17.0.1 -p tcp --dport 80 -j ACCEPT systemctl restart firewalld
firewall-cmdコマンドに --permanent を付けると、どこかに保存される。
CentOS7 第4回 はじめての firewalld で作る Linuxルータ – CLARA ONLINE techblog
ウェブサーバーの設定
dockerのゲスト(コンテナ)で実行。
yum install httpd service httpd start
vi /var/www/html/index.html
vi でindex.htmlを作って何か書く。
接続を試す
確認用PCから、
http://192.168.5.201/
にアクセス。
メモ
dockerコンテナ一覧
起動中のみ
docker ps
すべて表示
docker ps -a
dockerイメージ作成
docker commit -m "something comment" <CONTAINER ID> <イメージの名前>:<タグ>
docker commit -m "something comment" <CONTAINER ID> <イメージの名前>
dockerイメージ一覧
docker images
dockerイメージの削除
docker rmi <イメージ名>
iptablesルール削除
firewall-cmd --permanent --direct --remove-rule ipv4 nat PREROUTING_direct 0 -d 192.168.3.58 -j DNAT --to 172.17.0.3
RHEL7: How to get started with Firewalld. - CertDepot
↓は、sytemctl restart firewalld で元に戻ってしまう。
iptables -t nat -D PREROUTING_direct 1
dockerのローカルipを固定する
AWS上のWindows Server 2012 R2を起動したら英語キーボードだった
リモートデスクトップで接続して、
コロン(:)を入力しようとしたら、シングルクォート(')か何かが出た。
英語キーボードになっているようだった。
↓のページの手順で直った。
Windows Server/Windows Storage Server 2012のキーボード日本語化について | Dell US
(AWSのWindows Server 2012 R2は画面が英語たっだけど。)
手順メモ
デバイスマネージャーの起動
Keyboards > Remote Desktop Keyboard Device を右クリック
Update Driver Software...
Browse my computer for driver software
Let me pick from a list of device drivers on my computer
[互換性のあるハードウェアを表示]のチェックを外します。
製造元で[Microsoft]を、モデルで[Microsoft USB Office Keyboard(106/109)]を選択し[次へ]をクリックします。
Point Cloud Libraryのビューワーでkinectのデータを表示
Windows10で実行。
Point Cloud Libraryのインストールと設定 - kubotti’s memo
でPATH等は、設定済み。
Visual Studio 2013
Visual C++ > Win32 > Win32 Console Application
PclViewSample1
という名前でプロジェクト作成。
作成時のダイアログ(ウィザード)は、デフォルトのまま。
ネット上のどこかから取得したソースをコピペ。
// Sample.cpp : コンソール アプリケーションのエントリ ポイントを定義します。 // #include "stdafx.h" // Disable Error C4996 that occur when using Boost.Signals2. #ifdef _DEBUG #define _SCL_SECURE_NO_WARNINGS #endif #include "kinect2_grabber.h" #include <pcl/visualization/cloud_viewer.h> int _tmain( int argc, _TCHAR* argv[] ) { // Create Cloud Viewer pcl::visualization::CloudViewer viewer( "Point Cloud Viewer" ); // Callback Function to be called when Updating Data boost::function<void( const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr& )> function = [&viewer]( const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &cloud ){ if( !viewer.wasStopped() ){ viewer.showCloud( cloud ); } }; // Create Kinect2Grabber pcl::Grabber* grabber = new pcl::Kinect2Grabber(); // Regist Callback Function grabber->registerCallback( function ); // Start Retrieve Data grabber->start(); while( !viewer.wasStopped() ){ // Input Key ( Exit ESC key ) if( GetKeyState( VK_ESCAPE ) < 0 ){ break; } } // Stop Retrieve Data grabber->stop(); return 0; }
kinect2_grabber.h
KinectGrabber/kinect2_grabber.h at Kinect2Grabber · UnaNancyOwen/KinectGrabber · GitHub
kinect2_grabber.h
というファイルを
Projects\PclViewSample1\PclViewSample1
にコピー。
Solution ExplorerでHeader Filesを右クリック、
Add > Existing Item...
kinect2_grabber.h を追加。
kinect.h
Kinect for Windows SDK v2.0 で開発する環境を整える(C++編) - Natural Software
環境変数を確認したら、
KINECTSDK20_DIR
C:\Program Files\Microsoft SDKs\Kinect\v2.0_1409\
という値があった。
たぶん、Kinect SDKをインストールしたときに設定されたのだと思う。
構成の設定
Solution Explorerで、PclViewerSample1(プロジェクト名)を右クリック。
Release Property Pagesの
Configuration: で、All Configurations を選択。
Configuration Properties > C/C++ > General > Additional Include Directories
で、
$(KINECTSDK20_DIR)\inc
を追加。
Configuration Properties > Linker > General > Additional Library Directories
で、
$(KINECTSDK20_DIR)\lib\x64
を追加。
Configuration Properties > Linker > Input > Additional Dependencies
で、
Kinect20.lib
を追加。
エラーその1
Error 2 error LNK2001: unresolved external symbol GetDefaultKinectSensor c:\Users\aaaaaa\documents\visual studio 2013\Projects\PclViewSample1\PclViewSample1\PclViewSample1.obj PclViewSample1 Error 3 error LNK1120: 1 unresolved externals c:\users\aaaaaa\documents\visual studio 2013\Projects\PclViewSample1\x64\Release\PclViewSample1.exe PclViewSample1
原因は、上記の
Kinect20.lib
の追加をしていなかったからのようだった。
実行
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
ビルドに成功して、深度データ付きの画像が表示された。
実行直後は3色の正しく動いていない風な画面が表示される。
これをマウスホイールとマウスドラッグで動かすと3次元の画面を動かせる。
Ctrl + マウスドラッグ でz軸固定?
Shift + マウスドラッグ で平行移動
Ctrl + Shift + マウスドラッグ で拡大縮小(z軸のみ移動?)
Point Cloud Libraryのビューワーでサンプルデータを表示
kinectで取得したデータ(動画)をPCLのViewerで表示しようと思って、
前に作ったプロジェクトのコードをコピペしたら、ただのサンプルポイントクラウドデータを表示するコードだった。
やりたかったのはこれ↓
Point Cloud Libraryのビューワーでkinectのデータを表示 - kubotti’s memo
Visual Studio 2013
Point Cloud Libraryのインストールと設定 - kubotti’s memo
でPATH等は、設定済み。
Visual C++ > Win32 > Win32 Console Application
PclViewSample0
という名前でプロジェクト作成。
作成時のダイアログ(ウィザード)は、デフォルトのまま。
//// PclSample1.cpp : Defines the entry point for the console application. //// // //#include "stdafx.h" // // //int _tmain(int argc, _TCHAR* argv[]) //{ // return 0; //} // #include "stdafx.h" #include <pcl/visualization/cloud_viewer.h> #include <iostream> #include <pcl/io/io.h> #include <pcl/io/pcd_io.h> int user_data; void viewerOneOff(pcl::visualization::PCLVisualizer& viewer) { viewer.setBackgroundColor(1.0, 0.5, 1.0); pcl::PointXYZ o; o.x = 1.0; o.y = 0; o.z = 0; viewer.addSphere(o, 0.25, "sphere", 0); std::cout << "i only run once" << std::endl; } void viewerPsycho(pcl::visualization::PCLVisualizer& viewer) { static unsigned count = 0; std::stringstream ss; ss << "Once per viewer loop: " << count++; viewer.removeShape("text", 0); viewer.addText(ss.str(), 200, 300, "text", 0); //FIXME: possible race condition here: user_data++; } int main() { pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGBA>); pcl::io::loadPCDFile("my_point_cloud.pcd", *cloud); pcl::visualization::CloudViewer viewer("Cloud Viewer"); //blocks until the cloud is actually rendered viewer.showCloud(cloud); //use the following functions to get access to the underlying more advanced/powerful //PCLVisualizer //This will only get called once viewer.runOnVisualizationThreadOnce(viewerOneOff); //This will get called once per visualization iteration viewer.runOnVisualizationThread(viewerPsycho); while (!viewer.wasStopped()) { //you can also do cool processing here //FIXME: Note that this is running in a separate thread from viewerPsycho //and you should guard against race conditions yourself... user_data++; } return 0; }
x64のConfiguration
Active solution platform:
ダイアログで、
Type or select the new platform:
x64