CSF.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #pragma once
  2. //#######################################################################################
  3. //# #
  4. //# CLOUDCOMPARE PLUGIN: qCSF #
  5. //# #
  6. //# This program is free software; you can redistribute it and/or modify #
  7. //# it under the terms of the GNU General Public License as published by #
  8. //# the Free Software Foundation; version 2 or later of the License. #
  9. //# #
  10. //# This program is distributed in the hope that it will be useful, #
  11. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  12. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  13. //# GNU General Public License for more details. #
  14. //# #
  15. //# Please cite the following paper, If you use this plugin in your work. #
  16. //# #
  17. //# Zhang W, Qi J, Wan P, Wang H, Xie D, Wang X, Yan G. An Easy-to-Use Airborne LiDAR #
  18. //# Data Filtering Method Based on Cloth Simulation. Remote Sensing. 2016; 8(6):501. #
  19. //# #
  20. //# Copyright © #
  21. //# RAMM laboratory, School of Geography, Beijing Normal University #
  22. //# (http://ramm.bnu.edu.cn/) #
  23. //# #
  24. //# Wuming Zhang; Jianbo Qi; Peng Wan; Hongtao Wang #
  25. //# #
  26. //# contact us: 2009zwm@gmail.com; wpqjbzwm@126.com #
  27. //# #
  28. //#######################################################################################
  29. #include "wlPointCloud.h"
  30. #include "Cloth.h"
  31. //system
  32. #include <vector>
  33. class ccMainAppInterface;
  34. class ccPointCloud;
  35. class QWidget;
  36. class ccMesh;
  37. class CSF
  38. {
  39. public:
  40. //! Parameters
  41. struct Parameters
  42. {
  43. int k_nearest_points = 1;
  44. bool smoothSlope = true;
  45. double time_step = 0.65;
  46. double class_threshold = 0.5;
  47. double cloth_resolution = 1.0;
  48. int rigidness = 3;
  49. int iterations = 500;
  50. // constants
  51. const double clothYHeight = 0.05; // origin cloth height
  52. const int clothBuffer = 2; // cloth buffer (grid margin size)
  53. const double gravity = 0.2;
  54. };
  55. //! Main filtering routine
  56. static bool Apply( const wl::PointCloud& csfPointCloud,
  57. const Parameters& params,
  58. std::vector<bool>& isGround,
  59. bool exportClothMesh,
  60. ccMesh* &clothMesh,
  61. ccMainAppInterface* app = nullptr,
  62. QWidget* parent = nullptr);
  63. //! Shortcut for CloudCompare
  64. static bool Apply( ccPointCloud* cloud,
  65. const Parameters& params,
  66. ccPointCloud*& groundCloud,
  67. ccPointCloud*& offGroundCloud,
  68. bool exportClothMesh,
  69. ccMesh*& clothMesh,
  70. ccMainAppInterface* app = nullptr);
  71. };