Skip to content

Instantly share code, notes, and snippets.

@HTLife
Last active October 21, 2021 03:55
Show Gist options
  • Save HTLife/f19617ad0cd4e3c1248f946982d66400 to your computer and use it in GitHub Desktop.
Save HTLife/f19617ad0cd4e3c1248f946982d66400 to your computer and use it in GitHub Desktop.
Open3D linkage problem
cmake_minimum_required(VERSION 3.18)
project(Open3DCMakeFindPackage LANGUAGES C CXX)
# add_definitions(-D _GLIBCXX_USE_CXX11_ABI=1)
find_package(Open3D REQUIRED)
find_package(Boost REQUIRED COMPONENTS program_options)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
add_executable (Draw Draw.cpp)
target_link_libraries(Draw Open3D::Open3D ${Boost_LIBRARIES})
# docker build -f Dockerfile.base20 -t tseanliu/docker_env_gui:ubuntu20 .
FROM ubuntu:20.04
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES ${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
# install GLX-Gears
RUN apt-get update && apt-get install -y --no-install-recommends mesa-utils x11-apps && rm -rf /var/lib/apt/lists/*
# install useful tool
RUN apt-get update && apt-get install -y git vim
# COPY Open3D /home/Open3D
COPY install_deps_ubuntu.sh /home/install_deps_ubuntu.sh
RUN bash /home/install_deps_ubuntu.sh assume-yes
RUN apt-get install -y python3-pip
RUN pip3 install cmake --upgrade
RUN cd /home && git clone --recursive https://github.com/intel-isl/Open3D.git
WORKDIR /home/Open3D
RUN mkdir build && \
cd build && \
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${HOME}/open3d_install .. && \
cmake --build . --config Release --parallel 12 --target install && \
rm -rf /home/Open3D/build
RUN apt-get install libboost-all-dev
WORKDIR /home
#include <string>
#include "open3d/Open3D.h"
#include <boost/program_options.hpp>
namespace BPO = boost::program_options;
using namespace open3d;
int main(int argc, char *argv[]) {
// setup program options description
BPO::options_description bOptions( "Test Options" );
bOptions.add_options()
( "help", "Produce help message" )
( "vint", BPO::value<int>(), "int value" );
geometry::PointCloud pc2;
if (!open3d::io::ReadPointCloud(argv[1], pc2,
{"auto", false, false})) {
// utility::LogError("Failed to read from {}", argv[1]);
}
double voxel_size = 0.5;
auto pcd_down = pc2.VoxelDownSample(voxel_size);
bool write_ascii = true;
bool write_compressed = false;
std::string output_file_path = "down.pcd";
open3d::io::WritePointCloud(
output_file_path,
*pcd_down,
open3d::io::WritePointCloudOption(write_ascii, write_compressed,
false, {}));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment