CSF: Ground Filtering based on Cloth Simulation
Project description
CSF
Airborne LiDAR filtering method based on Cloth Simulation. This is the code for the article:
W. Zhang, J. Qi*, P. Wan, H. Wang, D. Xie, X. Wang, and G. Yan, “An Easy-to-Use Airborne LiDAR Data Filtering Method Based on Cloth Simulation,” Remote Sens., vol. 8, no. 6, p. 501, 2016. (http://www.mdpi.com/2072-4292/8/6/501/htm)
This is a modified version of the original Code for 3DFin purposes
For now this is only intended to be used inside 3DFin/dendromatics. But this repository also serve as a playground to bootstrap a planned full rewrite of CSF.
List of changes:
- Better handling of numpy arrays in the python bindings (avoid expensive copies)
- Bug fixes and improvement (mostly backport from CloudCompare version of CSF and original ones)
- Better (but yet to be improved) documentation and code structure.
New feature has been implemented:
Now, We has wrapped a Python interface for CSF with swig. It is simpler to use now. This new feature can make CSF easier to be embeded into a large project. For example, it can work with Laspy (https://github.com/laspy/laspy). What you do is just read a point cloud into a python 2D list, and pass it to CSF. The following example shows how to use it with laspy.
# coding: utf-8
import laspy
import CSF
import numpy as np
inFile = laspy.read(r"in.las") # read a las file
points = inFile.points
xyz = np.vstack((inFile.x, inFile.y, inFile.z)).transpose() # extract x, y, z and put into a list
csf = CSF.CSF()
# prameter settings
csf.params.bSloopSmooth = False
csf.params.cloth_resolution = 0.5
# more details about parameter: http://ramm.bnu.edu.cn/projects/CSF/download/
csf.setPointCloud(xyz)
ground = CSF.VecInt() # a list to indicate the index of ground points after calculation
non_ground = CSF.VecInt() # a list to indicate the index of non-ground points after calculation
csf.do_filtering(ground, non_ground) # do actual filtering.
outFile = laspy.LasData(inFile.header)
outFile.points = points[np.array(ground)] # extract ground points, and save it to a las file.
out_file.write(r"out.las")
Reading data from txt file:
If the lidar data is stored in txt file (x y z for each line), it can also be imported directly.
import CSF
csf = CSF.CSF()
csf.readPointsFromFile('samp52.txt')
csf.params.bSloopSmooth = False
csf.params.cloth_resolution = 0.5
ground = CSF.VecInt() # a list to indicate the index of ground points after calculation
non_ground = CSF.VecInt() # a list to indicate the index of non-ground points after calculation
csf.do_filtering(ground, non_ground) # do actual filtering.
csf.savePoints(ground,"ground.txt")
How to use CSF in Python
Thanks to @rjanvier's contribution. Now we can install CSF from pip as:
pip install cloth-simulation-filter
How to use CSF in Matlab
see more details from file demo_mex.m
under matlab folder.
How to use CSF in R
Thanks to the nice work of @Jean-Romain, through the collaboration, the CSF has been made as a R package, the details can be found in the RCSF repository. This package can be used easily with the lidR package:
library(lidR)
las <- readLAS("file.las")
las <- lasground(las, csf())
How to use CSF in C++
Now, CSF is built by CMake, it produces a static library, which can be used by other c++ programs.
linux
To build the library, run:
mkdir build #or other name
cd build
cmake ..
make
sudo make install
or if you want to build the library and the demo executable csfdemo
mkdir build #or other name
cd build
cmake -DBUILD_DEMO=ON ..
make
sudo make install
Windows
You can use CMake GUI to generate visual studio solution file.
Binary Version
For binary release version, it can be downloaded at: http://ramm.bnu.edu.cn/projects/CSF/download/
Note: This code has been changed a lot since the publication of the corresponding paper. A lot of optimizations have been made. We are still working on it, and wish it could be better.
Cloudcompare Pulgin
At last, if you are interested in Cloudcompare, there is a good news. our method has been implemented as a Cloudcompare plugin, you can refer to : https://github.com/cloudcompare/trunk
Related project
A tool named CSFTools
has been recently released, it is based on CSF, and provides dem/chm generation, normalization. Please refer to: https://github.com/jianboqi/CSFTools
License
CSF is maintained and developed by Jianbo QI. It is now released under Apache 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for CSF_3DFin-1.3.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c582a40cf309f4a51a15df9a909d3c3c34f7bc6c6980d1fdfc71bf338c053dd1 |
|
MD5 | cd015ce0b92464324cae701a56100cd3 |
|
BLAKE2b-256 | d163a07702603e719eebde7ac313b2da12e544d23eaaaa1e84b53258f6bed4fd |
Hashes for CSF_3DFin-1.3.0-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa1db38d2530558173a41b6369415a0b75de39852867278cc91a07604e65e414 |
|
MD5 | 7a02c81658414ff8073c6fa61251c1b9 |
|
BLAKE2b-256 | e520a075dacb375dc59f5d4c6c7d679648c795603322c8be487fc791047fa52a |
Hashes for CSF_3DFin-1.3.0-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08cb9e04583d0b830f83971d1bb21af43c946b3a8a3bd8533f7a9287c980cc6d |
|
MD5 | 2550cc5269c0f75cc069d6adfc1d3497 |
|
BLAKE2b-256 | 9b0ba6ef0e7787d331e776cbb2ca0c94e253e151934be2f335b998fa9342957c |
Hashes for CSF_3DFin-1.3.0-cp312-cp312-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5599b3797b818810bc89690fee505ed0dd799e5379797d61b5dae847f840e88 |
|
MD5 | edf91a8feb78148e6cdd2795fe6da6c3 |
|
BLAKE2b-256 | 76cc57a837cc055348f7dc45b02441fe1df9908221b4590fb740375e0eecbe38 |
Hashes for CSF_3DFin-1.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3247a9839ef0adfa3c440f232e6ac8af425bd1f66603e49574b7bc4281e601d6 |
|
MD5 | aec63356d68c453dfbfd138aa1e35142 |
|
BLAKE2b-256 | ec68f0f5b67888d3071c35f935a5131dee132b5455c461f53fc034a405551205 |
Hashes for CSF_3DFin-1.3.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39d8d29e588b6408c25c2ab2b2a9286eb0cef1e7e051e47d6bb5ab00171853aa |
|
MD5 | 4d915031162e5626f6d450256d0d2c6d |
|
BLAKE2b-256 | 588cdc265a9e4a36bf7fcc9f793165dfe31d80c0b58c4f65f8f10ce8ef95c306 |
Hashes for CSF_3DFin-1.3.0-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5e1c92acde7ba318bf8f744b743af811d36c63b55aff9d9212f3347df4151ed |
|
MD5 | ea8fe161b46be42f703fc359291f2a8a |
|
BLAKE2b-256 | 2c97427d4affdb113ed18195c75e512585866a02dae5e31cc41fd41435227e74 |
Hashes for CSF_3DFin-1.3.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d47e150d3228fcc0587c2fa7ae85cabaddec989eb388bae50ba0b44b30bb5320 |
|
MD5 | 048f94d129fefa16a378d4cb1135bed6 |
|
BLAKE2b-256 | 567bab72088983a3fb9b45f15324ac47d6589183f37a42365644cf41ec2c4b16 |
Hashes for CSF_3DFin-1.3.0-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16e8cd7dbb33cce18ea78f526f35defc94b417b3e41fc3033ff9629d887b90cf |
|
MD5 | 7235f85dfd0dd23cf80a07ec87ffc10c |
|
BLAKE2b-256 | ca9fa60dd50308a7f208d68c76ed046d2437d6d0d96e686c99ab0c237619c2a1 |
Hashes for CSF_3DFin-1.3.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e10d751f10c599e5fd53a3ab19a9ba3d353b55c8cfe8034f86f489a964fe25fc |
|
MD5 | 4242e8614cc680e704ab93d0773b4e76 |
|
BLAKE2b-256 | 80ad3b3c3615451488a04269a3851be34b4d384c437abd485c974b002f057f8e |
Hashes for CSF_3DFin-1.3.0-cp311-cp311-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1222980d7c2b10ffe14df9e9744cac81149954241ff2d6df0e91fc1d63c0451 |
|
MD5 | 251b71bcd20fc0de8085b94fb3750f2f |
|
BLAKE2b-256 | 22e725cf7b9a3a2834533b1bed94abe5aec2eef6b09f243f0844789f56a9591b |
Hashes for CSF_3DFin-1.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a24d9da81fef6cc5940483754bde96de75fe678b0568df27a432bd689acb6781 |
|
MD5 | f70e68ef8f08d7bc0fb6a1e46ad45531 |
|
BLAKE2b-256 | 297d4234d5123f0e12e209b505e72396334362a469737ec97e4a39e49fcecd1b |
Hashes for CSF_3DFin-1.3.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4279f46f2379c623ca738382dbbfde639425626ede47a80bc30588522a728d52 |
|
MD5 | 121f6d0050dbf2e937f1c2b46698ef0a |
|
BLAKE2b-256 | f32fb7f37d3d6f8773ff4538b20f4713ecc2f540fc7bee7810a32830bd1c8741 |
Hashes for CSF_3DFin-1.3.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04fd25fd34ad30df40f46021573495e3cb132518d5e45c0ee7b45127d63450b6 |
|
MD5 | 326ac3ee810ab9d2b04dd4de327f9da3 |
|
BLAKE2b-256 | e78c3803dece36afd794ad3d696cabdd7523417365a7ac30ffff63a420608996 |
Hashes for CSF_3DFin-1.3.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 472e92816c8372ee4ba6ddf92bd27b770783518260b0bfa7f15d7b728373fe57 |
|
MD5 | f1bec62affda5286ec6863d7f68accd9 |
|
BLAKE2b-256 | be9bcedacd7e8635d1884bbf14a70fc3f7e9ffcba6ea70efc59e36aec50afb94 |
Hashes for CSF_3DFin-1.3.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ae85dfc2a0224555652ed2fbdabf7795af6d6c66a3bbd6e5c3a3bf37d285701 |
|
MD5 | eaf0933ee91415cd0828a2a4b5b790f0 |
|
BLAKE2b-256 | 53d3a19c8420a657aed603a08dab5e96872df1d450b65782733b5d2c2cd4b424 |
Hashes for CSF_3DFin-1.3.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9b118b04461393d7eb9886c403bca0615a89450d829eb122ed4e0b6aed70617 |
|
MD5 | 019137ce14d11d2380af8b09cf3d9f59 |
|
BLAKE2b-256 | 8632ee508edf2d9a146e1987ad50d5766705e3a5ddff6dd9d39e55a8449940ef |
Hashes for CSF_3DFin-1.3.0-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bee2536b0c6ce9c5f2985974145f872dca77932ac110b8f6657a8efed737642 |
|
MD5 | ebd2cfa8f2b51f2782a0a5c8e3e8c9e8 |
|
BLAKE2b-256 | 19df399cca993d4ddf61f2650a8454f82fe76c709e177c3208837dd304db2711 |
Hashes for CSF_3DFin-1.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 759f17889fed3a258bc11775803fe0ad4d8487a898af8da3528bc09feb3ac7c3 |
|
MD5 | d0ea2dfe016be5fd7c23e1a4f88d8aec |
|
BLAKE2b-256 | 4d84b1f04f315642da624fdeba3c13a2b9b054c4c11713190c4a9889bf848896 |
Hashes for CSF_3DFin-1.3.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0a064b5f21fe3307bb38e33874a6d86809fd83c1bbd89509c4f2c7e27874055 |
|
MD5 | 566ccb3e0469ab98d53209245bf74b7f |
|
BLAKE2b-256 | 5e62f1a5e0063d16389753764d00f80a60d009120d551be0c7abcf6dfcf74d63 |
Hashes for CSF_3DFin-1.3.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6908c5a29ebd2010063bfb8549b490db3dfdd72816c7549d13bfab1573ba3914 |
|
MD5 | 24e1f735ddb7c8e33699adef171bf6cb |
|
BLAKE2b-256 | 326fe7c909980f428dedb07829ea90a4424d9f0a177cb78ebe70a4c3e350d2bb |
Hashes for CSF_3DFin-1.3.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cbe6600d83477298e2f07de6ad0788293ac3b667f023997387e97f0e557640a |
|
MD5 | b61d52e7aff2194a3ce051bdcf10bf85 |
|
BLAKE2b-256 | 41161e0be057c58b4b6f2833a7c604eb3b99644a9733a351769997b5b33ae5fc |
Hashes for CSF_3DFin-1.3.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd824f0ce17eb0126726bcd153ad5081e9c2e782e01f141f4edb5497e2bc7645 |
|
MD5 | 3463b09c3773e2ee1dbe1acd911934da |
|
BLAKE2b-256 | d415a19a8ba0dc97d76da81c194cc637813b4b9bbd20e79f2f9a27ecc42823ae |
Hashes for CSF_3DFin-1.3.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f19df0610a6fd20967c55b3f1587572035d8c91736fc3f13d0421de50645d102 |
|
MD5 | bd355f1c64a2f205b53512ffb8e8bcc9 |
|
BLAKE2b-256 | c4d0cdbdd1a6a02a24fc503ac7848cb5496befda6e07750fb519dea8a60e3c0c |
Hashes for CSF_3DFin-1.3.0-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f93c6c91ba747c3e8461064575395a699904960f1dc88ccf290f44368edac88 |
|
MD5 | 8d4bf1cd14ec4ed97e61e9e7fc326538 |
|
BLAKE2b-256 | 5a2864e5cbd303055b32999018456affe9a65aa28a5c74a706cb71b022af17a5 |
Hashes for CSF_3DFin-1.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce27ba39256690f4bb5b5c7b59e1fbbde7ee92d2edaa04a79a6a215e2cfa7a6b |
|
MD5 | 9b810215098fb58daf254eeaf4551f1c |
|
BLAKE2b-256 | 730a6777096a7346ae8c751fd90eb41a7a57e8ec33b787e4bb3cb793ab054b1d |
Hashes for CSF_3DFin-1.3.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7281956828e606164abb5cff78b6bd18abdd838697d58af9ec07f329ba2ff92 |
|
MD5 | 48d0add753d4c2fdf3c47a993439307a |
|
BLAKE2b-256 | 1fe12f268bda28d5ca9e95e28de3f9693f9e53d9404b4290051b2a91146876cc |
Hashes for CSF_3DFin-1.3.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fda30df74220bd281bd23ebb359d5756b35833a0a3ff2e86bd6ed83c0c7462a |
|
MD5 | 9db601fd5c0c9d038b1f44bd9fa0731e |
|
BLAKE2b-256 | f9ce5758128d339a8df9c09b2ea90732e6bcf40ab16c360648d9424b0b6e74ea |