pcl+vtk (2) Ubuntu18.04 download and install pcl1.13+vtk8.2 based on QT, and uninstall

1. Differences between QVTKWidget, QVTKWidget2, QVTKOpenGLWidget, QVTKOpenGLNativeWidget

1.Qt version

Versions before Qt5.4: QVTKWidget2/QVTKWidget.

Qt5.4 and later versions: QVTKOpenGLWidget/QVTKOpenGLWidget.

2.VTK version (Qt version is after 5.4)

In versions before VTK8.2: QVTKOpenGLWidget;
In VTK8.2 and later versions: QVTKOpenGLNativeWidget;

QVTKWidget: What I know so far is that it can only display point clouds, and there is no example of displaying the model found online.

QVTKOpenGLNativeWidget: can display both point cloud and model.

It is recommended to download pcl1.13+vtk8.2 directly and use QVTKOpenGLNativeWidget directly. Don’t download this one after seeing that most of them are vtk7.1+pcl1.9 on the Internet like I did before, and then uninstall and re-download the higher version if it does not meet the needs.

2. Install qt

Use the command to install the Qt version 5.9.5 supported by default in ubuntu18.04. If you need a higher version, just go to the QT official website to download the installation package.

rely

sudo apt install build-essential

sudo apt install cmake

sudo apt install qt5-default qtbase5-dev

sudo apt install qtcreator

IDE documentation

sudo apt install qt5tools-dev qt5tools-dev-tools qt5tools-doc qt5tools-examples 

Version management tool

sudo apt install qtchooser

2. Install vtk8.2

Government location:Download | VTK

Download version 8.2 source code

After unzipping, go to the folder.

Then follow these steps:

Among them, /usr/lib/qt5/bin/qmake is the installation directory of QT's qmake, and /usr/lib/x86_64-linux-gnu/cmake is the path in QT that instructs CMake to find the library files required for packages and projects. I QT is installed using system commands, so the directory is under the system directory. If you download the installation package to install QT, you can check the directory where you put it (I think most of the online qmake is in /opt/Qt5.12.9/5.12.9/gcc_64/bin/qmake, and cmake is in /opt/Qt5.12.9/5.12 .9/gcc_64/lib/cmake). To ensure correctness, go to the corresponding directory to check whether there is qmake and cmake below before executing.

mkdir release
cd release
cmake -DVTK_QT_VERSION:STRING=5 \
              -DQT_QMAKE_EXECUTABLE:PATH=/usr/lib/qt5/bin/qmake \
              -DVTK_Group_Qt:BOOL=ON \
              -DCMAKE_PREFIX_PATH:PATH=/usr/lib/x86_64-linux-gnu/cmake  \
              -DCMAKE_BUILD_TYPE=RELEASE \
              -DBUILD_SHARED_LIBS:BOOL=ON ..

make
sudo make install

Note: Be sure to add the configuration item after cmake, otherwise the libQVTKWidgetPlugin.so library will not be generated. (The libQVTKWidgetPlugin.so library is only used to add this control to the draggable generated control in the QtCreator design interface)

After the installation is complete, add QVTKWidget to QtCreator and execute the following command to find the path

sudo find / -name libQVTKWidgetPlugin.so

 You can see that the directory is:

/usr/local/plugins/designer/libQVTKWidgetPlugin.so

Copy libQVTKWidgetPlugin.so to the relevant library path of QT.

Since I downloaded QT directly using the command, the directory I moved to is as follows:

/usr/lib/x86_64-linux-gnu/qt5/plugins/designer/

/usr/lib/x86_64-linux-gnu/qtcreator/plugins/

If you download the installation package and install QT, you can check the directory where you placed it. Most of them on the Internet are:

/opt/Qt5.12.9/5.12.9/gcc_64/plugins/designer/
/opt/Qt5.12.9/Tools/QtCreator/lib/Qt/plugins/designer/

The above installation is complete.

Problems encountered during installation

Question 1

vtk CMake Error at Rendering/OpenGL2/CMakeLists.txt:154 (message):   X11_Xt_LIB could not be found.  Required for VTK X lib.

solve:

sudo apt-get install libxt-dev

Question 2

CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:26 (find_package):
  Could not find a package configuration file provided by "Qt5X11Extras" with
  any of the following names:

    Qt5X11ExtrasConfig.cmake
    qt5x11extras-config.cmake

  Add the installation prefix of "Qt5X11Extras" to CMAKE_PREFIX_PATH or set
  "Qt5X11Extras_DIR" to a directory containing one of the above files.  If
  "Qt5X11Extras" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  VTK/GUISupport/Qt/CMakeLists.txt:69 (find_package)

solve:

sudo apt install libqt5x11extras5-dev

 Question 3

CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:26 (find_package): Could not find a package configuration file provided by “Qt5UiPlugin” with any of the following names:

Qt5UiPluginConfig.cmake
qt5uiplugin-config.cmake
Add the installation prefix of “Qt5UiPlugin” to CMAKE_PREFIX_PATH or set “Qt5UiPlugin_DIR” to a directory containing one of the above files. If “Qt5UiPlugin” provides a separate development package or SDK, be sure it has been installed.

solve:

sudo apt-get install qttools5-dev

Question 4

CMake Error at CMakeLists.txt:156 (export):
  export EXPORT or TARGETS specifier missing.

solve:

Adjust this place as follows:

if (_vtk_compiletools_targets)
  list(REMOVE_DUPLICATES _vtk_compiletools_targets)
  export(TARGETS ${_vtk_compiletools_targets}
    FILE ${VTK_BINARY_DIR}/VTKCompileToolsConfig.cmake)
  add_dependencies(vtkCompileTools ${_vtk_compiletools_targets})
endif()
也就是把156,157行挪到endif中,保存后再来Configure。

3. Install pcl1.13

Install dependencies first

sudo apt-get update
sudo apt-get install git build-essential
sudo apt-get install cmake cmake-gui
sudo apt-get install libflann1.9 libflann-dev
sudo apt-get install libeigen3-dev
sudo apt-get install libboost-all-dev

  Source code address:https://github.com/PointCloudLibrary/pcl.git

Go to git to directly download the source code of version 1.13.1, unzip it and enter the directory.

Execute the following command

mkdir release
cd release
cmake -DCMAKE_BUILD_TYPE=None \
      -DCMAKE_INSTALL_PREFIX=/usr/local \
      -DBUILD_GPU=ON \
      -DBUILD_apps=ON \
      -DBUILD_examples=ON ..
make
sudo make install

The above installation is complete. At this point vtk and pcl have been installed.

Verification of successful installation:

Open the terminal in the pcl directory and execute the command:

pcl_viewer point cloud file name

4. Uninstall vtk

1. Use sudo apt-get install libvtk7.1-qt libvtk7.1 libvtk7-qt-dev to install dependencies

Just execute the command directly

sudo apt-get remove libvtk7*

2. Delete libraries and header files

Search the computer for the content and corresponding location of the vtk installation, and execute the command to delete it.

You must be cautious and cautious! ! ! ! After confirming, delete it. The sudo command cannot be revoked.

sudo rm -rf /usr/local/include/vtk-8.2/

sudo rm -f /usr/local/lib/libvtk*-8.2.*

5. Uninstall pcl

Find the content and corresponding location of the pcl installation on the computer, and then execute the command directly.

Execute the uninstall command directly in the compiled folder (mine is release)

sudo make uninstall

You must be cautious and cautious! ! ! ! After confirming, delete it. The sudo command cannot be revoked.

sudo rm -rf /usr/local/include/pcl-1.9/
sudo rm -rf /usr/local/share/pcl-1.9/
sudo rm -rf /usr/local/bin/pcl*
sudo rm -rf /usr/local/lib/libpcl*

Guess you like

Origin blog.csdn.net/m0_67254672/article/details/133770844