You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -21,7 +20,7 @@ Python wrapper around C++ helper to compute, for each point in a 3D point cloud,
21
20
- linearity
22
21
- planarity
23
22
- scattering
24
-
- verticality
23
+
- verticality (two formulations)
25
24
- normal_x
26
25
- normal_y
27
26
- normal_z
@@ -32,109 +31,41 @@ Python wrapper around C++ helper to compute, for each point in a 3D point cloud,
32
31
- optimal neighborhood size
33
32
</details>
34
33
34
+
The wrapper allows to compute feature in multiple fashions (on the fly subset of features _a la_ jakteritics or an array of features, multiscale features). Moreover, it offers basic interfaces to compute fast K-NN or Radius search on point clouds.
35
+
The overall code is not intended to be DRY nor generic, it aims at providing efficient as possible implementations for some limited scopes and usages.
35
36
36
37
## 🧱 Installation
37
38
38
-
Pgeof will __soon__ be available as pre compiled package on PyPI for both Linux and Windows OSes.
39
-
40
39
```bash
41
-
python -m pip install pgeof
40
+
python -m pip install pgeof2
42
41
```
43
42
44
43
### building from sources
45
44
46
-
Pgeof depends on [Eigen library](https://eigen.tuxfamily.org/) and numpy headers at build time.
47
-
The good version of numpy will be fetched from PyPI automatically by the build system but your are responsible for providing
48
-
the path to the Eigen library you want to use (for example py using `CXXFLAGS` variable on Linux or setting `EIGEN_LIB_PATH`)
45
+
Pgeof depends on [Eigen library](https://eigen.tuxfamily.org/), [Taskflow](https://github.com/taskflow/taskflow),
46
+
[nanoflann](https://github.com/jlblancoc/nanoflann) and [nanobind](https://github.com/wjakob/nanobind).
Pgeof adhere to [PEP 517](https://peps.python.org/pep-0517/) and use [scikit-build-core](https://github.com/scikit-build/scikit-build-core) as build backend. Build dependencies (nanobind, scikit-build-core...) are fetched at build time. C++ third party libraries are embedded as submodules.
60
50
61
-
### conda
62
-
63
-
The following will install the project in a new `pgeof` conda environment.
# Installation in a new dedicated `pgeof` conda environment
71
-
bash install.sh
56
+
# build and install the package
57
+
python -m pip install .
72
58
```
73
59
74
-
You can easily adapt `install.sh` to install the project in an already-existing
75
-
environment.
76
-
77
60
## 🚀 Using Point Geometric Features
78
61
79
-
The `pgeof` function should be used as follows:
80
-
81
-
```python
82
-
from pgeof import pgeof
83
-
84
-
pgeof(
85
-
xyz, # [n_points, 3] float32 2D array - 3D point coordinates
86
-
nn, # [num_neighborhoods] uint32 1D array - Flattened neighbor indices. Make sure those are all positive, '-1' indices will either crash or silently compute incorrect features
87
-
nn_ptr, # [n_points+1] uint32 1D array - Pointers wrt `nn`. More specifically, the neighbors of point `i` are `nn[nn_ptr[i]:nn_ptr[i + 1]]`
88
-
k_min=1, # (optional, default=1) int - Minimum number of neighbors to consider for features computation. If a point has less, it will be given 0 features
89
-
k_step=-1, # (optional, default=-1) int - Step size to take when searching for the optimal neighborhood size for each point, following: http://lareg.ensg.eu/labos/matis/pdf/articles_revues/2015/isprs_wjhm_15.pdf. If k_step < 1, pgeof will not search for the optimal neighborhood and features will be computed based on the all available neighbors for each point
90
-
k_min_search=10, # (optional, default=10) int - Minimum neighborhood size at which to start when searching for the optimal neighborhood size for each point. It is advised to use a value of 10 or higher, for geometric features robustness
91
-
verbose=False) # (optional, default=False) bool - Whether computation progress should be printed out
92
-
93
-
# Print details on how pgeof works and expected input parameters
94
-
print(help(pgeof))
95
-
```
96
-
97
-
👇 You may check out the provided `demo.py` script to get started.
98
-
99
-
```bash
100
-
python demo.py
101
-
```
62
+
👇 You may check out the provided `test_pgeof.py` script to get started.
102
63
103
64
⚠️ Please note the **neighbors are expected in CSR format**. This allows
104
65
expressing neighborhoods of varying sizes with dense arrays (eg the output of a
105
66
radius search). Here are examples of how to easily convert typical k-NN or
106
67
radius-NN neighborhoods to CSR format.
107
68
108
-
```python
109
-
from sklearn.neighbors import NearestNeighbors
110
-
import numpy as np
111
-
112
-
# Generate a random synthetic point cloud and k-nearest neighbors
nn_ptr = np.r_[0, np.array([x.shape[0] for x in rneigh[1]]).cumsum()]
135
-
nn = np.concatenate(rneigh[1])
136
-
```
137
-
138
69
139
70
## 💳 Credits
140
71
This implementation was largely inspired from [Superpoint Graph](https://github.com/loicland/superpoint_graph). The main modifications here allow:
@@ -143,6 +74,17 @@ This implementation was largely inspired from [Superpoint Graph](https://github.
143
74
- optimal neighborhood search from this [paper](http://lareg.ensg.eu/labos/matis/pdf/articles_revues/2015/isprs_wjhm_15.pdf)
144
75
- some corrections on geometric features computation
145
76
77
+
Some heavy refactoring (port to nanobind, test, benchmarks), packaging, speed optimization, feature addition (NN search, on the fly feature computation...) were funded by:
78
+
79
+
Centre of Wildfire Research of Swansea University (UK) in collaboration with the Research Institute of Biodiversity (CSIC, Spain) and the Department of Mining Exploitation of the University of Oviedo (Spain).
80
+
81
+
Funding provided by the UK NERC project (NE/T001194/1):
82
+
83
+
'Advancing 3D Fuel Mapping for Wildfire Behaviour and Risk Mitigation Modelling'
84
+
85
+
and by the Spanish Knowledge Generation project (PID2021-126790NB-I00):
86
+
87
+
‘Advancing carbon emission estimations from wildfires applying artificial intelligence to 3D terrestrial point clouds’.
0 commit comments