A Python-based project for processing Point Cloud Data (PCD) files, featuring background removal and point cloud clustering capabilities.
- Background removal from point cloud data
- Point cloud clustering (2D and 3D)
- Multiple processing methods:
- Brute force
- KD-tree
- Octree
- Spherical coordinates
- Voxel-based
- Ground plane detection
- Visualization tools
Demonstration of the background removal process
-
Clone the repository:
git clone https://github.com/moonmoonmoonmoon/static_background_removal.git cd background-removal
-
Install required packages:
pip install -r requirements.txt
Run the main script with default parameters:
python main.py
Key parameters that can be adjusted in the processing pipeline:
- Background Removal:
distance_threshold
: Distance threshold for background point detectionangle_threshold
: Angle threshold for background point detection
- Clustering:
eps
: The maximum distance between two samples for them to be considered neighborsmin_samples
: The minimum number of samples in a cluster
- Ground Detection:
distance_threshold
: Maximum distance from point to plane for ground classificationmax_iterations
: Number of RANSAC iterations
background-removal/
├── src/
│ ├── clustering/
│ │ ├── __init__.py
│ │ ├── cluster_2d.py
│ │ └── cluster_3d.py
│ ├── find_background/
│ │ ├── __init__.py
│ │ ├── find_cartesian.py
│ │ └── find_spherical.py
│ ├── find_ground/
│ │ ├── __init__.py
│ │ └── find_ground.py
│ ├── process_point_cloud/
│ │ ├── __init__.py
│ │ ├── process_brute.py
│ │ ├── process_kdtree.py
│ │ ├── process_octree.py
│ │ ├── process_spherical.py
│ │ ├── process_voxel.py
│ │ └── utils.py
│ ├── utils/
│ │ ├── __init__.py
│ │ └── utils.py
│ ├── visualization/
│ │ ├── __init__.py
│ │ └── visualization.py
│ └── __init__.py
├── dataset # Contains datasets for testing
│ │ ├── static # Static background datasets
│ │ │ └── lowell # Lowell dataset for static scenes
│ │ ├── moving # Moving background datasets
│ │ │ └── boston_vehicle_mount # Boston vehicle-mounted dataset for dynamic scenes
├── output # Output folder for processed data and transmation matrix
├── LICENSE
├── README.md
├── main.py
├── requirements.txt
├── images/
└── tree_generator.py
clustering/
: Implements 2D and 3D point cloud clustering algorithmsfind_background/
: Contains algorithms for background detection in both Cartesian and spherical coordinatesfind_ground/
: Implements ground plane detection algorithms and get transformation martixprocess_point_cloud/
: Core processing algorithms including various optimization methodsutils/
: Common utility functionsvisualization/
: Tools for visualizing point cloud data and results
We welcome contributions to improve the project! Here's how you can contribute:
- Fork the repository
- Create a virtual environment (using conda):
conda create -n background-removal python=3.11 conda activate background-removal
- Install development dependencies:
pip install -r requirements.txt
- Follow PEP 8 coding standards
- Use meaningful variable and function names
- Add docstrings to functions and classes
- Keep functions focused and single-purpose
-
Create a new branch for your feature:
git checkout -b your-branch-name
-
Make your changes and commit:
git add . git commit -m "Meaningful commit message"
-
Push to your fork:
git push origin your-branch-name
-
Create a Pull Request (PR) from your fork to our main repository
- Provide a clear description of the changes
- Include any relevant issue numbers
- Ensure all tests pass
- Add unit tests for new features
- Update documentation if needed
When reporting issues, please include:
- A clear description of the problem
- Steps to reproduce the issue
- Expected vs actual behavior
- System information (OS, Python version, etc.)
This project is licensed under the MIT License - see the LICENSE file for details.