Series
- Part-1: Install and Configure Qt5 on Ubuntu 16.04
- Part-2: Install and Configure VTK 8.1.0 from source with Qt5 on Ubuntu 16.04
- Part-3: Install and Configure PCL 1.8.1 with vtk qt support on Ubuntu 16.04 from source
- Part-4: Install and Configure PCL 1.8.1 with vtk qt support on windows 10 from source
Guide
Tips
we’d better to use SSD to compile source code instead HDD. So put source code in C folder on windows.
use multiple processor to compile with/MP
options.
prepare
software
- vs: vs2015 installer
- qt: http://mirrors.tuna.tsinghua.edu.cn/qt/archive/qt/5.7/5.7.1/qt-opensource-windows-x86-msvc2015_64-5.7.1.exe
- qt vs tools: https://mirrors.tuna.tsinghua.edu.cn/qt/archive/vsaddin/qt-vs-tools-msvc2015-2.1.1.vsix
- pcl installer: https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.8.1/PCL-1.8.1-AllInOne-msvc2015-win64.exe
- vtk source: https://www.vtk.org/files/release/8.1/VTK-8.1.0.zip
- vtk data: https://www.vtk.org/files/release/8.1/VTKData-8.1.0.zip
- pcl source: https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.1.zip
download
1 | wget https://www.vtk.org/files/release/8.1/VTK-8.1.0.zip |
version
window: 10
qt: 5.7.1
qmake: 3.0 based on Qt 5.7.1
qtcreator: 4.2.0 based on Qt 5.7.1
qt-vs-tools: 2.2.1
cmake/gui: 3.10.0
vtk: 8.1.0 (source)
vtk data: 8.1.0
pcl: 1.8.1 (source)
$ qmake -v
QMake version 3.0
Using Qt version 5.7.1 in C:/Qt/Qt5.7.1/5.7/msvc2015_64/lib
$ qtcreator -version
Qt Creator 4.2.0 based on Qt 5.7.1
$ cmake -version
cmake version 3.10.0
install vs2015
skip.
configure vs2015 with admin
when we compile pcl by vs2015 and install to folder C:/Program Files/PCL
, we need administrative priviledges.
follow steps:
cmd+r
regeidt
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
# new string entry
key: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe
value: ~ RUNASADMIN
install qt
install qt to path C:\Qt\Qt5.7.1
add the following to system path.
C:\Qt\Qt5.7.1\5.7\msvc2015_64\bin
C:\Qt\Qt5.7.1\Tools\QtCreator\bin
install qt-vs-tools
online install by vs2015
start vs2015, install Qt Visual Sutido Tools
by:
Tools---> Extensions and Update... ---> online search qt ---> install Qt Visual Sutido Tools ---> OK
restart vs2015 and new menu Qt VS Tools
will be added to VS Main menu.
offline install by vsix
wget https://mirrors.tuna.tsinghua.edu.cn/qt/archive/vsaddin/qt-vs-tools-msvc2015-2.1.1.vsix
double click qt-vs-tools-msvc2015-2.1.1.vsix
and install.
configure qt for vs
follow steps
Qt VS Tools ---> Qt Options ---> Add name and path
Add qt path for vs2015 so that we can find %PATH%\bin\qmake.exe
Name: Qt 5.7.1
Path: C:\Qt\Qt5.7.1\5.7\msvc2015_64\
new qt project from vs
start vs2015, and new Qt Gui Application
.
Compile and run first qt program.
Success.
install pcl third parties
install pcl by installer
install pcl to C:\Program Files\PCL 1.8.1\
choose to install OpenNI2 to C:\Program Files\PCL 1.8.1\3rdParty\OpenNI2\
this process will add 4 system env.
PCL_ROOT C:\Program Files\PCL 1.8.1
OPENNI2_INCLUDE64 C:\Program Files\PCL 1.8.1\3rdParty\OpenNI2\Include\
OPENNI2_LIB64 C:\Program Files\PCL 1.8.1\3rdParty\OpenNI2\Lib\
OPENNI2_REDIST64 C:\Program Files\PCL 1.8.1\3rdParty\OpenNI2\Redist\
configure env
add env to Path
.
%PCL_ROOT\bin
%PCL_ROOT%\3rdParty\FLANN\bin
%PCL_ROOT%\3rdParty\OpenNI2\Redist
%PCL_ROOT%\3rdParty\OpenNI2\Tools
%PCL_ROOT%\3rdParty\Qhull\bin
%PCL_ROOT%\3rdParty\VTK\bin
copy winpap package
copy winpap to C:\Program Files\PCL 1.8.1\3rdParty\
, and 3rdParty folder looks like this:
$ ls -al
total 16
drwxr-xr-x 1 zunli 197609 0 1月 11 12:47 ./
drwxr-xr-x 1 zunli 197609 0 1月 11 08:03 ../
drwxr-xr-x 1 zunli 197609 0 1月 11 08:02 Boost/
drwxr-xr-x 1 zunli 197609 0 1月 11 08:01 Eigen/
drwxr-xr-x 1 zunli 197609 0 1月 11 08:02 FLANN/
drwxr-xr-x 1 zunli 197609 0 1月 11 08:04 OpenNI2/
drwxr-xr-x 1 zunli 197609 0 1月 11 08:02 Qhull/
drwxr-xr-x 1 zunli 197609 0 1月 11 08:03 VTK/
drwxr-xr-x 1 zunli 197609 0 1月 11 12:47 winpcap/
compile vtk
download vtk and data
1 | wget https://www.vtk.org/files/release/8.1/VTK-8.1.0.zip |
configure source
we need to compile vtk to replace C:\Program Files\PCL 1.8.1\3rdParty\VTK\
1 | cd c:/compile/VTK-8.1.0 |
configure generator to Visual Studio 14 2015 Win64
with options
VTK_Group_Qt ON
VTK_QT_VERSION 5 # by default 4
VTK_RENDERING_BACKEND OpenGL2 # by default OpenGL
Qt5_DIR C:/Qt/Qt5.7.1/5.7/msvc2015_64/lib/cmake/Qt5
CMAKE_INSTALL_PREFIX C:/Program Files/VTK # by default
BUILD_SHARED_LIBS ON
CMAKE_CONFIGURATION_TYPES Release # Release
CMAKE_CXX_FLAGS_RELEASE /MD /O2 /Ob2 /DNDEBUG /MP # for multiple processor
unzip
VTKData-8.1.0.zip
and copyMD5
toVTK-8.1.0/build/ExternalData/Objects/MD5
Detailed steps as follows:
With VTK = 8.1.0:
VTK_Group_Qt ON
configure again, and then
QT_QMAKE_EXECUTABLE
andVTK_QT_VERSION
will appear.we need to change
VTK_QT_VERSION
from 4 to 5.VTK_QT_VERSION 5 # by default 4
change
VTK_RENDERING_BACKEND
from OpenGL to OpenGL2.VTK_RENDERING_BACKEND OpenGL2 # by default OpenGL
set install path
C:\Program Files\VTK\
CMAKE_INSTALL_PREFIX C:/Program Files/VTK
we need write privileges to install to
C:\Program Files\VTK\
we should also notice
BUILD_SHARED_LIBS
BUILD_SHARED_LIBS ON
add
/MP
for multiple processor compileCMAKE_CXX_FLAGS_RELEASE /MD /O2 /Ob2 /DNDEBUG /MP # for multiple processor CMAKE_CXX_MP_FLAG ON CMAKE_CXX_MP_NUM_PROCESSORS 8
Configure
compile
If everything goes well, then generate VTK.sln
.
Open VTK.sln
in vs2015 and build with Release X64
.
NOTICE: this build process will take about 10 minutes.(10:35-10:45)
install vtk
choose INSTALL
and generate , and VTK will be installed to C:\Program Files\VTK\
.
Notice for QVTKWidgetPlugin
and copy dll and lib to C:\Program Files\VTK\
.
- dll: copy
C:\compile\VTK-8.1.0\build\bin\Release\QVTKWidgetPlugin.dll
toC:\Program Files\VTK\bin\QVTKWidgetPlugin.dll
- lib: copy
C:\compile\VTK-8.1.0\build\lib\Release\QVTKWidgetPlugin.lib
toC:\Program Files\VTK\lib\QVTKWidgetPlugin.lib
we should also notice that dll has been copied to C:\Program Files\VTK\plugins\designer\QVTKWidgetPlugin.dll
copy vtk to pcl
copy vtk from C:\Program Files\VTK\
to C:/Program Files/PCL 1.8.1/3rdParty/VTK
to replace old one.
install QVTKWidgetPlugin
copy C:\Program Files\VTK\plugins\designer\QVTKWidgetPlugin.dll
toC:\Qt\Qt5.7.1\5.7\msvc2015_64\plugins\designer
start vs2015 again, view mainwindow.ui
in Qt Designer
.
Now QVTKWidget
will occur.
compile pcl
3rdParty
install pcl to get 3rdparty libraries and copy to proper folder.
- Boost: C:/Boost/include lib version: 1.64 (auto find by cmake)
- eigen3: C:/Program Files/Eigen/eigen3, version: 3.3.4 (auto find by cmake)
- FLANN: C:/Program Files/FLANN/include lib bin (auto find by cmake)
- OpenNI2: C:/Program Files/OpenNI2/Include Lib Redist (user input)
- Qhull: C:/Program Files/Qhull/include lib bin (auto find by cmake)
- winpcap: C:/Program Files/winpcap/Include Lib (user input)
cmake options
OpenNI2 include: C:/Program Files/OpenNI2/Include
OpenNI2 LIBRARY: C:/Program Files/OpenNI2/Lib/OpenNI2.lib
pcap include: C:/Program Files/winpcap/Include
pcap library: C:/Program Files/winpcap/Lib/x64/wpcap.lib
configure
1 | cd c:/compile/pcl-1.8.1 |
with options
QT_USE_FILE C:/compile/pcl-1.8.1/build/use-qt5.cmake
VTK_DIR C:/Program Files/VTK/lib/cmake/vtk-8.1
CMAKE_INSTALL_PREFIX C:/Program Files/PCL
PCL_SHARED_LIBS ON
PCL_QT_VERSION 5
PCL_ENABLE_SSE ON
CMAKE_BUILD_TYPE Release
CMAKE_CONFIGURATION_TYPES Release
CMAKE_INSTALL_PREFIX C:/Program Files/PCL
CMAKE_CXX_FLAGS_RELEASE /MD /O2 /Ob2 /DNDEBUG /MP # for multiple processor
Build_visualization ON
Build_apps OFF
Build_examples OFF # error may occur
# Fix zlib and png
zlib include: C:/Program Files/VTK/include/vtk-8.1/vtkzlib
zlib library: C:/Program Files/VTK/lib/vtkzlib-8.1.lib
png include: C:/Program Files/VTK/include/vtk-8.1/vtkpng
png library: C:/Program Files/VTK/lib/vtkpng-8.1.lib
configure output
code;arch=compute_53,code=sm_53;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61
...
Boost version: 1.64.0
Found the following Boost libraries:
system
filesystem
thread
date_time
iostreams
chrono
atomic
regex
DOXYGEN_FOUND
HTML_HELP_COMPILER
Found CPack generators: NSIS
The following subsystems will be built:
common
octree
io
kdtree
search
sample_consensus
filters
2d
geometry
features
ml
segmentation
surface
registration
keypoints
tracking
recognition
stereo
tools
The following subsystems will not be built:
visualization: Disabled manually.
apps: Disabled: visualization missing.
outofcore: Requires visualization.
examples: Code examples are disabled by default.
people: Requires visualization.
simulation: Disabled: visualization missing.
global_tests: No reason
Configuring done
OK.
compile
If everything goes well, then generate PCL.sln
Open PCL.sln
in vs2015 and build with Release X64
.
NOTICE: this build process will take about 30 minutes.
install pcl
by default install need administrator privilidges to write to
C:/Program Files/PCL/
.
choose INSTALL
and generate , and PCL will be installed to C:/Program Files/PCL
.
Example
pcl only
pcd_write.cpp
1 |
|
CMakeLists.txt
1 | cmake_minimum_required(VERSION 2.8 FATAL_ERROR) |
run demo
compile to pcd_write_test.exe
and run, errors may occur:
pcd_write_test.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
we need to find out which dlls are imported by exe.
wget http://www.dependencywalker.com/depends22_x64.zip
Tips: use
dependency walker
to check which dlls are imported, and then copy dll to exe folder.
copypcl/bin/*.dll
andvtk/bin/*.dll
to exe folder.
run exe and output
$ ./pcd_write_test.exe
Saved 5 data points to test_pcd.pcd.
1.28125 577.094 197.938
828.125 599.031 491.375
358.688 917.438 842.563
764.5 178.281 879.531
727.531 525.844 311.281
cat pcd
$ cat test_pcd.pcd
# .PCD v0.7 - Point Cloud Data file format
VERSION 0.7
FIELDS x y z
SIZE 4 4 4
TYPE F F F
COUNT 1 1 1
WIDTH 5
HEIGHT 1
VIEWPOINT 0 0 0 1 0 0 0
POINTS 5
DATA ascii
1.28125 577.09375 197.9375
828.125 599.03125 491.375
358.6875 917.4375 842.5625
764.5 178.28125 879.53125
727.53125 525.84375 311.28125
create pcl project with vtk and qt support.
pcl+vtk+qt PointCloud Viewer (RECOMMEND)
This project use QVTKWidgetPlugin
to display point cloud data.
- mainwindow.h
- mainwindow.cpp
- mainwindow.ui (Contains QVTKWidgetPlugin)
- main.cpp
- CMakeLists.txt
mainwindow.h
1 |
|
mainwindow.cpp
1 |
|
main.cpp
1 |
|
mainwindow.ui
1 | <?xml version="1.0" encoding="UTF-8"?> |
CMakeLists.txt
1 | cmake_minimum_required(VERSION 2.8.8) |
snapshot
./point_cloud_viewer.exe
errors
when run example, errors may occur: (which has been fixed by now.)
fix error
fix pcl min,max conflict with windows.h macro
error
C:\Boost\include\boost-1_64\boost\asio\detail\socket_types.hpp(37):# include <windows.h>
we use boost which includes<windows.h>
and import macromin/max
.
in pcl,std::numeric_limits<int>::max
conflict withmin/max
.
1 | template <typename PointT> static std::string |
solution
1 | // method(1): put this befor pcl headers |
Reference
- good pcl tutorials
- Building PCL 1.7.2 with Visual Studio
- offical: compile pcl on windows
- offical: using pcl example
- offical: writing pcd
- offical pcl with qt visualizer
- offical: pcl with ros
- install pcl by isstallers
- pcl point cloud realtime viewer
- no-override-found-for-vtkpolydatamappe
- VTK 6 Migration/Factories now require defines
History
- 20180112: created.
- 20180208: add DependencyWalker,add pcl pcd demo, pcl+vtk+qt demo.
- 20180211: add vs2015 regedit for runasadmin.
- 20180301: change VTK-8.0.1 to VTK-8.1.0.