qq456cvb / CPPF2

6D Pose Estimation in the Wild
MIT License
22 stars 2 forks source link

Unable to build the shot.cpp file #3

Closed dvirginz closed 6 months ago

dvirginz commented 1 year ago

Hi,

Could you please share more information about the system (was Docker used?) that was used to build the shot script? I have tried multiple Python configurations, including different versions of Ubuntu and g++, but have had no luck.

Thank you!

qq456cvb commented 1 year ago

Hi Dvir,

We use Ubuntu 16.04, Python 3.6.12 and gcc-7/g++-7 (7.3.0) for building the script. What kind of error do you meet? You can paste them here and we'd like to have a look.

dvirginz commented 1 year ago

Hi!

It was a dependency nightmare, but thank you very much!

For future reference, here is a working Dockerfile to build the shot.cpp.

Thank you!!

FROM ubuntu:16.04

RUN apt-get update && \
    apt-get install nano && \
    echo "alias python=python3.6" >> ~/.bashrc && \
    echo "alias pip=pip3" >> ~/.bashrc 

RUN apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev && \
cd /tmp && \
wget https://www.python.org/ftp/python/3.6.12/Python-3.6.12.tgz && \
tar xvf Python-3.6.12.tgz && \
cd Python-3.6.12 && \
./configure --enable-optimizations && \
make -j 8 && \
make altinstall

RUN apt-get remove python2.7 -y && \
apt-get remove python3.5 -y && \
apt install build-essential libtool autoconf unzip wget -y && \
version=3.21 && \
build=3 && \
mkdir -p /tmp
RUN cd /tmp && \
wget https://cmake.org/files/v3.21/cmake-3.21.3.tar.gz && \
tar -xzvf cmake-3.21.3.tar.gz && \
cd cmake-3.21.3/ && \
./bootstrap && \
make -j$(nproc) && \
make install && \
cmake --version

RUN cd /tmp && \
wget https://github.com/pybind/pybind11/archive/v2.7.1.tar.gz && \
tar xvzf v2.7.1.tar.gz && \
cd pybind11-2.7.1/ && \
mkdir build && \
cd build && \
cmake .. && \
make -j && \
make install

RUN cd /tmp && \
apt-get install -y mesa-utils libgl1-mesa-glx libgl1-mesa-dev && \
wget http://launchpadlibrarian.net/209530212/libeigen3-dev_3.2.5-4_all.deb && \
dpkg -i libeigen3-dev_3.2.5-4_all.deb && \
apt-mark hold libeigen3-dev && \
wget http://www.vtk.org/files/release/7.1/VTK-7.1.0.tar.gz && \
tar -xf VTK-7.1.0.tar.gz && \
cd VTK-7.1.0 && \
mkdir build && \
cd build && \
cmake .. && \
make && \
make install

RUN apt-get install libeigen3-dev libflann-dev liblz4-dev libboost-all-dev -y --allow-change-held-packages
RUN cd /tmp && \
wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.0.tar.gz && \
tar -xf pcl-1.8.0.tar.gz && \
cd pcl-pcl-1.8.0 && \
mkdir build && \
cd build && \
cmake .. && \
make && \
make install
qq456cvb commented 1 year ago

Glad that you make it work! Yes, building PCL with C++ is not an easy work, thanks for sharing your Docker file and we will consider adding them to README with your credits.

eclipse0922 commented 2 months ago

For those looking to avoid installing PCL, please consider using Cupoch. yes It is another dependency, but much easier to install and able to compute with GPU.

# use cupoch to compute the shot features and normals
pcd_cph = cph.geometry.PointCloud()
pcd_cph.points = cph.utility.Vector3fVector(pc)

max_k = 100
radius_feat= cfg.res*10
# compute normal
pcd_cph.estimate_normals(search_param=cph.geometry.KDTreeSearchParamRadius(radius=radius_feat, max_nn=max_k))

# compute shot
shot_feat = cph.registration.compute_shot_feature(pcd_cph, radius_feat, cph.geometry.KDTreeSearchParamRadius(radius=radius_feat, max_nn=100))

# to numpy
pointNormals = np.asarray(pcd_cph.normals.cpu())
shot_feat = np.asarray(shot_feat.data.cpu())