(Detailed PCL installation) PCL+python+windows+anaconda environment

        After reading a lot of related blogs, I feel that there are very few complete and detailed ones, so I decided to write an article for code friends who have not installed it and for myself. I wrote a blog last time "Installing the python_pcl library in the anaconda environment of windows" and the link is as follows:

(Detailed installation of python_pcl) python_pcl+windows+anaconda

        If you want to use the visualization module of the PCL library, you need to install the PCL library in an additional way of compiling source code. However, this is also the most uncomfortable point, because the PCL library is not like installing other libraries, directly pip install the library name in the virtual environment or download the whl file and then pip install whl to install. The installation of the PCL library needs to download the installation package + some compressed packages that need to be used + environment configuration, and the version cannot conflict before, which is very troublesome, so let’s not talk nonsense and go directly to the topic.

        First of all, I recommend that the virtual environment is a python3.6 environment, because 3.6 is the version with the least problems. If you have not created and will not create a virtual environment, you can search for "how to create anaconda virtual environment".

1. What to download

I have packed all the files in the picture above and put them in the Baidu cloud disk below, and I can pick them up if I need them.

Link: https://pan.baidu.com/s/1_etR5JMsHYNRkxVx4ugoPA 
Extraction code: mlbx

        If you want to download the PCL installation package yourself, I recommend downloading 1.9.1 or the following version, because I have installed a higher version, but the virtual environment installation process upgrades my version to 1.9-1.7. 

 2. Install PCL-1.9.1-AllInOne-msvc2017-win64

        All the time, the next step/I accept it, here choose to automatically configure the system environment.

        It is recommended to create an installation directory by yourself. First, it is convenient to configure environment variables, and second, it is convenient to find the root folder when needed.

        During the installation, the OpenIN2 installer may pop up, which is still the next step/I accept, but the installation target can be the default installation directory, or D:\PCL 1.9.1\3rdParty\OpenNI2 (to facilitate the addition of environment variables, less prone to errors). If the OpenNI2 installer does not pop up, you can find it in the default installation directory C:\Program Files\OpenNI2 or D:\PCL 1.9.1\3rdParty\OpenNI2

 Install it yourself.

3. Decompress pcl-1.9.1-pdb-msvc2017-win64

        After decompressing pcl-1.9.1-pdb-msvc2017-win64, copy all the files in the decompressed folder to the D:\PCL 1.9.1\bin directory.

4. Configure system environment variables

         Enter the system environment variable configuration interface: Right click on this computer and select Properties—>Advanced System Settings—>Advanced—>Environment Variables

        Under normal circumstances, the red box is automatically configured during installation, check whether it exists, if not, add it yourself.

        Double-click the Path variable in the system variables

         The first five are irrelevant, mainly focus on the next eight environment variables, and add what is missing. After the addition is complete, click OK instead of the X in the upper right corner.

D:\PCL 1.9.1\bin;
D:\PCL 1.9.1\3rdParty\Boost\lib;
D:\PCL 1.9.1\3rdParty\FLANN\bin;
D:\PCL 1.9.1\3rdParty\Qhull\bin;
D:\PCL 1.9.1\3rdParty\VTK\bin;
D:\PCL 1.9.1\3rdParty\OpenNI2\Lib;
D:\PCL 1.9.1\3rdParty\OpenNI2\Redist;
D:\PCL 1.9.1\3rdParty\OpenNI2\Tools;

 5. Install vs_BuildTools (to provide a compilation environment for the installation of the virtual environment later)

        The installation process is still to continue\Next step, when you get to the step below, select the first VS C++ generation tool, and check the five in the picture below in the installation information on the right, and then click Install in the lower right corner.

 6. Unzip python-pcl-master and gtk+-bundle_3.6.4-20130513_win64

        Method 1: Copy and paste all files under D:\PCL 1.9.1\gtk+-bundle_3.6.4-20130513_win64\bin after decompression to D:\PCL 1.9.1\python-pcl-master\python-pcl after decompression -master\pkg-config folder, or

        Method 2: Find the following file directly in D:\PCL 1.9.1\python-pcl-master\python-pcl-master\pkg-config, right-click to run as an administrator (if you directly right-click to run as an administrator, some dlls may be missing file, it is recommended to use method 1).

        

        Enter capital R and press Enter to continue the installation.

        After the installation is complete, you need to restart the computer, because some programs need to be restarted to take effect after installation.

7. Enter the virtual environment to install the PCL library

        The last step is to enter cmd in the directory bar in the figure below and press Enter to directly enter the command line in the directory.

Then enter the name of the activate virtual environment (the version of my virtual environment is python3.6)

        Then enter pip list to check whether Cython is installed and whether the version is high enough. If it is not installed or you do not know whether the version is suitable, enter pip install cython.

 Enter python setup.py build_ext -i and press Enter to install. After the installation is successful, enter python setup.py install and press Enter to install

python setup.py build_ext -i
python setup.py install

        If you get to this point, congratulations, the installation is successful! You can use the following code to test it (you can use your own path for the point cloud file).

import pcl
import pcl.pcl_visualization
fileName='D:\\pythonProject3\\PointCloud\\PCData\\bun000.pcd' #用自己的点云文件路径
cloud=pcl.load_XYZRGB(fileName)
visual = pcl.pcl_visualization.CloudViewing()

print(cloud[1])
visual.ShowColorCloud(cloud, b'cloud')
v = True
while v:
    v = not (visual.WasStopped())

The renderings are as follows:

Guess you like

Origin blog.csdn.net/xsh_roy/article/details/124093988