Skip to content

Commit 85edec2

Browse files
authored
Merge pull request #49 from LimHyungTae/better_instructions
Better instructions
2 parents 3e0a57a + 6b56714 commit 85edec2

14 files changed

+362
-107
lines changed

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pyinstall:
2+
@python3 -m pip install --upgrade pip
3+
@pip install numpy
4+
@pip install --verbose ./python/
5+
6+
pyinstall_with_demo: pyinstall
7+
@pip install open3d==0.18.0
8+
9+
cppinstall:
10+
@cmake -Bcpp/build cpp/
11+
@cmake --build cpp/build -j$(nproc --all)
12+
13+
cppinstall_with_demo:
14+
@cmake -Bcpp/build cpp/ -DINCLUDE_CPP_EXAMPLES=ON
15+
@cmake --build cpp/build -j$(nproc --all)

README.md

Lines changed: 48 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -45,86 +45,66 @@
4545
[examplelink]: https://github.com/url-kaist/patchwork-plusplus/tree/master/examples
4646

4747
## :package: Prerequisite packages
48-
> You may need to install Eigen, numpy, and Open3D. Open3D is used for point cloud visualization.
48+
> What we need are just minimal dependencies.
4949
50-
```bash
51-
# Install prerequisite packages including Open3D
52-
$ git clone https://github.com/url-kaist/patchwork-plusplus
53-
$ cd patchwork-plusplus
54-
$ bash scripts/install_open3d.bash
55-
```
56-
57-
<details>
58-
<summary> Manual Installation line-by-line </summary>
59-
60-
```bash
61-
# To install Eigen and numpy
62-
$ sudo apt-get install libeigen3-dev
63-
$ pip install numpy
64-
65-
# To install Open3D Python packages
66-
$ pip install open3d
67-
68-
# To install Open3D C++ packages
69-
$ git clone https://github.com/isl-org/Open3D
70-
$ cd Open3D
71-
$ util/install_deps_ubuntu.sh # Only needed for Ubuntu
72-
$ mkdir build && cd build
73-
$ cmake ..
74-
$ make # If it fails, try several times or try 'sudo make'
75-
$ sudo make install
50+
```commandline
51+
sudo apt-get install g++ build-essential libeigen3-dev python3-pip python3-dev cmake -y
7652
```
7753

7854
</details>
7955

80-
## :gear: How to build
81-
> Please follow below codes to build Patchwork++.
56+
## :gear: How to build & Run
8257

8358
### Python
84-
```bash
85-
# in patchwork-plusplus directory
86-
$ cd python && pip install .
87-
```
8859

89-
### C++
90-
```bash
91-
# in patchwork-plusplus directory
92-
$ mkdir cpp/build && cd cpp/build
93-
$ cmake ..
94-
$ make
60+
**Pure installation**
61+
62+
```commandline
63+
make pyinstall
9564
```
9665

97-
## :runner: To run the demo codes
98-
> There are some example codes for your convenience!
99-
> Please try using Patchwork++ to segment ground points in a 3D point cloud :smiley:
66+
Then, you can use Patchwork++ by `import pypatchworkpp`, which is super simple!
10067

101-
### Python
102-
```bash
103-
# Run patchwork++ and visualize ground points(green) and nonground points(red)
104-
$ python examples/demo_visualize.py
68+
**Installation to run demo**
69+
70+
Only Open3D (> 0.17.0) is additionally installed for visualization purposes.
10571

106-
# Run patchwork++ with sequential point cloud inputs
107-
$ python examples/demo_sequential.py
72+
```commandline
73+
make pyinstall_with_demo
10874
```
10975

76+
How to run Python demos is explained [here](https://github.com/url-kaist/patchwork-plusplus/tree/master/python/README.md#Demo).
77+
11078
### C++
111-
```bash
112-
# Run patchwork++ and visualize ground points(green) and nonground points(red)
113-
$ ./examples/demo_visualize
11479

115-
# Run patchwork++ with sequential point cloud inputs
116-
$ ./examples/demo_sequential
80+
**Pure installation**
81+
82+
```commandline
83+
make cppinstall
84+
```
85+
86+
**Installation with demo**
87+
88+
Only Open3D (> 0.17.0) is additionally installed for visualization purposes.
11789

118-
# Run patchwork++ with your point cloud file, example here
119-
$ ./examples/demo_visualize ./data/000000.bin # specify file path
90+
```commandline
91+
make cppinstall_with_demo
12092
```
12193

122-
### Demo Result
123-
If you execute Patchwork++ with given demo codes well, you can get the following result!
94+
How to run the C++ demos is explained [here](https://github.com/url-kaist/patchwork-plusplus/tree/master/cpp).
95+
96+
### ROS2
97+
98+
You should not need any extra dependency, just clone and build:
99+
100+
```commandline
101+
cd colcon_ws/src && git clone
102+
cd ../../
103+
colcon build --packages-select patchworkpp
104+
```
124105

125-
It is a ground segmentation result of data/000000.bin file using Open3D visualization. (Ground : Green, Nonground : Red)
106+
How to launch ROS2 nodes is explained [here](https://github.com/url-kaist/patchwork-plusplus/tree/master/cpp).
126107

127-
![Open3D Visualization of "data/000000.bin"](pictures/demo_000000.png)
128108

129109
## :pencil: Citation
130110
If you use our codes, please cite our paper ([arXiv][arXivLink], [IEEE *Xplore*][patchworkppIEEElink])
@@ -168,3 +148,12 @@ If you have any questions, please do not hesitate to contact us
168148

169149
[sjlink]: https://github.com/seungjae24
170150
[htlink]: https://github.com/LimHyungTae
151+
152+
153+
---
154+
155+
## Todo List
156+
- [ ] Support intensity for RNR in `master` branch
157+
- [ ] Support `Patchwork` mode for users who use this repository for baseline comparison purposes
158+
- [ ] Integrate TBB and optimize the performance
159+

cpp/CMakeLists.txt

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
cmake_minimum_required(VERSION 3.11)
2-
project(PATCHWORK VERSION 1.0.0)
2+
project(patchworkpp VERSION 1.0.0)
33

44
set(CMAKE_CXX_STANDARD 20)
55
set(PYTHON_EXECUTABLE python3)
66
set(CMAKE_BUILD_TYPE Release)
77

8-
98
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${Open3D_C_FLAGS}")
109
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Open3D_CXX_FLAGS}")
1110
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${Open3D_EXE_LINKER_FLAGS}")
@@ -17,30 +16,47 @@ else()
1716
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
1817
endif()
1918

19+
option(INCLUDE_CPP_EXAMPLES "Include C++ example codes, which require Open3D for visualization" OFF)
2020

21-
list(APPEND Open3D_LIBRARIES dl)
21+
# Parameters in `patchworkpp` subdirectory.
22+
# Thus, link should be `patchworkpp::ground_seg_cores`
23+
set(PARENT_PROJECT_NAME ${PROJECT_NAME})
24+
set(TARGET_NAME ground_seg_cores)
2225

2326
add_subdirectory(patchworkpp)
2427

25-
set(INCLUDE_EXAMPLES ON CACHE BOOL "Build examples")
28+
if (INCLUDE_CPP_EXAMPLES)
29+
if(CMAKE_VERSION VERSION_LESS "3.15")
30+
# Just automatically update cmake version
31+
execute_process(COMMAND bash ../scripts/install_latest.cmake.bash
32+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
33+
endif()
2634

27-
if (INCLUDE_EXAMPLES)
35+
list(APPEND Open3D_LIBRARIES dl)
2836

2937
message(STATUS "Building examples for c++")
30-
find_package(Open3D REQUIRED HINTS ${CMAKE_INSTALL_PREFIX}/lib/CMake)
38+
find_package(Open3D QUIET)
39+
if (NOT Open3D_FOUND)
40+
message(STATUS "Open3D not found, installing Open3D...")
41+
execute_process(COMMAND bash ../scripts/install_open3d.bash
42+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
43+
find_package(Open3D REQUIRED HINTS ${CMAKE_INSTALL_PREFIX}/lib/CMake)
44+
else()
45+
message(STATUS "Found Open3D ${Open3D_VERSION}")
46+
endif()
3147

3248
list(APPEND Open3D_LIBRARIES dl)
3349
link_directories(${Open3D_LIBRARY_DIRS})
3450
message(STATUS "Found Open3D ${Open3D_VERSION}")
3551

3652
add_executable(demo_visualize ${CMAKE_CURRENT_SOURCE_DIR}/patchworkpp/examples/demo_visualize.cpp)
37-
target_link_libraries(demo_visualize PRIVATE PATCHWORK::patchworkpp ${Open3D_LIBRARIES} "stdc++fs")
53+
target_link_libraries(demo_visualize PRIVATE ${PARENT_PROJECT_NAME}::${TARGET_NAME} ${Open3D_LIBRARIES} "stdc++fs")
3854
target_include_directories(demo_visualize PUBLIC ${Open3D_INCLUDE_DIRS})
3955
set_target_properties(demo_visualize PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples")
4056

4157
add_executable(demo_sequential ${CMAKE_CURRENT_SOURCE_DIR}/patchworkpp/examples/demo_sequential.cpp)
42-
target_link_libraries(demo_sequential PRIVATE PATCHWORK::patchworkpp ${Open3D_LIBRARIES} "stdc++fs")
58+
target_link_libraries(demo_sequential PRIVATE ${PARENT_PROJECT_NAME}::${TARGET_NAME} ${Open3D_LIBRARIES} "stdc++fs")
4359
target_include_directories(demo_sequential PUBLIC ${Open3D_INCLUDE_DIRS})
4460
set_target_properties(demo_sequential PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples")
4561

46-
endif()
62+
endif()

cpp/README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<div align="center">
2+
<h1>Patchwork++</h1>
3+
<a href="https://github.com/url-kaist/patchwork-plusplus/tree/master/patchworkpp"><img src="https://img.shields.io/badge/-C++-blue?logo=cplusplus" /></a>
4+
<a href="https://github.com/url-kaist/patchwork-plusplus/tree/master"><img src="https://img.shields.io/badge/Python-3670A0?logo=python&logoColor=ffdd54" /></a>
5+
<a href="https://github.com/url-kaist/patchwork-plusplus/tree/master/ros"><img src="https://img.shields.io/badge/ROS2-Humble-blue" /></a>
6+
<a href="https://github.com/url-kaist/patchwork-plusplus/tree/master"><img src="https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black" /></a>
7+
<a href="https://ieeexplore.ieee.org/document/9981561"><img src="https://img.shields.io/badge/DOI-10.1109/IROS47612.2022.9981561-004088.svg"/>
8+
<br />
9+
<br />
10+
<a href=https://www.youtube.com/watch?v=fogCM159GRk>Video</a>
11+
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
12+
<a href="https://github.com/url-kaist/patchwork-plusplus/tree/master/README.md###Python">Install</a>
13+
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
14+
<a href="https://github.com/url-kaist/patchwork-plusplus/tree/master/ros">ROS2</a>
15+
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
16+
<a href=https://www.youtube.com/watch?v=fogCM159GRk>Paper</a>
17+
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
18+
<a href=https://github.com/url-kaist/patchwork-plusplus/issues>Contact Us</a>
19+
<br />
20+
<br />
21+
<p align="center"><img src=../pictures/patchwork++.gif alt="animated" /></p>
22+
23+
[Patchwork++][arXivlink], an extension of [Patchwork][patchworklink], is **a fast, robust, and self-adaptive ground segmentation algorithm** on 3D point cloud.
24+
</div>
25+
26+
[arXivlink]: https://arxiv.org/abs/2207.11919
27+
[patchworklink]: https://github.com/LimHyungTae/patchwork
28+
29+
---
30+
31+
# Patchwork++ in C++
32+
33+
## Manual Installation Just in Case
34+
35+
```commandline
36+
# in patchwork-plusplus directory
37+
$ cd cpp && mkdir build && cd build
38+
$ cmake -DCMAKE_BUILD_TYPE=Release ..
39+
$ make -j 16
40+
```
41+
42+
If you want to run demo, just run
43+
44+
```commandline
45+
make cppinstall_with_demo
46+
```
47+
48+
in the top-level directory, or
49+
50+
```commandline
51+
# in patchwork-plusplus directory
52+
$ cd cpp && mkdir build && cd build
53+
$ cmake -DCMAKE_BUILD_TYPE=Release -DINCLUDE_CPP_EXAMPLES=ON ..
54+
$ make -j 16
55+
```
56+
57+
> [!WARNING]
58+
> Please check your cmake version via `cmake --version`.
59+
> If it is lower than 3.20, it is automatically updated by `scripts/install_latest_cmake.bash` (see [here](https://github.com/url-kaist/patchwork-plusplus/blob/master/cpp/CMakeLists.txt#L31)).
60+
61+
## :runner: To run the demo codes
62+
> There are some example codes for your convenience!
63+
> Please try using Patchwork++ to segment ground points in a 3D point cloud :smiley:
64+
65+
66+
* Example 1. Run patchwork++ and visualize ground points (green) and non-ground points (red)
67+
```commandline
68+
./cpp/build/examples/demo_visualize
69+
```
70+
71+
* Example 2. Run patchwork++ with sequential point cloud inputs
72+
```commandline
73+
./cpp/build/examples/demo_sequential
74+
```
75+
76+
* Example 3. Run patchwork++ with your point cloud file, example here
77+
```commandline
78+
./examples/demo_visualize ./data/000000.bin # specify file path
79+
```
80+
81+
### Demo Result
82+
If you execute Patchwork++ with given demo codes well, you can get the following result!
83+
84+
It is a ground segmentation result of data/000000.bin file using Open3D visualization. (Ground : Green, Nonground : Red)
85+
86+
![Open3D Visualization of "data/000000.bin"](../pictures/demo_000000.png)
87+

cpp/patchworkpp/CMakeLists.txt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,34 @@ project(patchworkpp_src)
22

33
include(GNUInstallDirs)
44

5+
message("Parent project name: " ${PARENT_PROJECT_NAME})
6+
57
find_package(Eigen3 REQUIRED QUIET)
68

7-
add_library(patchworkpp STATIC src/patchworkpp.cpp)
8-
set_target_properties(patchworkpp PROPERTIES POSITION_INDEPENDENT_CODE ON)
9+
add_library(${TARGET_NAME} STATIC src/patchworkpp.cpp)
10+
set_target_properties(${TARGET_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
911

10-
target_include_directories(patchworkpp PUBLIC
12+
target_include_directories(${TARGET_NAME} PUBLIC
1113
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
1214
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
1315
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
1416
)
15-
target_link_libraries(patchworkpp Eigen3::Eigen)
16-
add_library(PATCHWORK::patchworkpp ALIAS patchworkpp)
17+
target_link_libraries(${TARGET_NAME} Eigen3::Eigen)
18+
add_library(${PARENT_PROJECT_NAME}::${TARGET_NAME} ALIAS ${TARGET_NAME})
1719

1820
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
1921
DESTINATION include
2022
)
21-
install(TARGETS patchworkpp
22-
EXPORT PATCHWORKConfig
23+
install(TARGETS ${TARGET_NAME}
24+
EXPORT ${PARENT_PROJECT_NAME}Config
2325
LIBRARY DESTINATION lib
2426
)
2527

26-
export(TARGETS patchworkpp
27-
NAMESPACE PATCHWORK::
28-
FILE "${CMAKE_CURRENT_BINARY_DIR}/PATCHWORKConfig.cmake"
28+
export(TARGETS ${TARGET_NAME}
29+
NAMESPACE ${PARENT_PROJECT_NAME}::
30+
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PARENT_PROJECT_NAME}Config.cmake"
2931
)
30-
install(EXPORT PATCHWORKConfig
31-
DESTINATION "${CMAKE_INSTALL_DATADIR}/PATCHWORK/cmake"
32-
NAMESPACE PATCHWORK::
32+
install(EXPORT ${PARENT_PROJECT_NAME}Config
33+
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PARENT_PROJECT_NAME}/cmake"
34+
NAMESPACE ${PARENT_PROJECT_NAME}::
3335
)

pictures/patchwork2_in_ros2.gif

4.47 MB
Loading

python/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ set(CMAKE_BUILD_TYPE Release)
66
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
77
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
88

9+
# Parameters used in `patchworkpp` subdirectory.
10+
# Thus, link should be `patchworkpp::ground_seg_cores`
11+
# See https://github.com/url-kaist/patchwork-plusplus/tree/master/cpp/CMakeLists.txt#L21
12+
set(PARENT_PROJECT_NAME patchworkpp)
13+
set(TARGET_NAME ground_seg_cores)
14+
915
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
1016
find_package(pybind11 CONFIG REQUIRED)
1117

@@ -21,7 +27,7 @@ endif()
2127

2228
pybind11_add_module(pypatchworkpp patchworkpp/pybinding.cpp)
2329

24-
target_link_libraries(pypatchworkpp PUBLIC PATCHWORK::patchworkpp)
30+
target_link_libraries(pypatchworkpp PUBLIC ${PARENT_PROJECT_NAME}::${TARGET_NAME})
2531

2632
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
2733
target_compile_options(pypatchworkpp PUBLIC -fsized-deallocation)

0 commit comments

Comments
 (0)