NickySpatial¶
An open-source object-based image analysis library for remote sensing.
Category | Badge |
---|---|
Build | |
Code Quality | |
Documentation | |
Package Info | |
Community |
[!WARNING] This project is under active development and lot of its functionality is still in my head yet to code.
Find Demo Frontend Here : https://nickyspatial-gpoqz.ondigitalocean.app/
Description¶
NickySpatial is a Python package that provides object-based image analysis (OBIA) functionality similar to commercial software like eCognition. It allows users to segment geospatial imagery into meaningful objects, calculate statistics, and apply rule-based classification.
Project Structure¶
nickyspatial/
├── __init__.py
├── io/
│ ├── __init__.py
│ ├── raster.py # Raster I/O
│ └── vector.py # Vector I/O
├── core/
│ ├── __init__.py
│ ├── layer.py # Layer class and management
│ ├── segmentation.py # Segmentation algorithms
│ └── rules.py # Rule engine
| └── classifier.py # Classification algorithms
├── stats/
│ ├── __init__.py
│ ├── basic.py # Basic statistics (min, max, mean, etc.)
│ ├── spatial.py # Spatial statistics (area, perimeter, etc.)
│ └── spectral.py # Spectral indices (NDVI, etc.)
├── filters/
│ ├── __init__.py
│ ├── spatial.py # Spatial filters (smoothing, merging)
│ └── spectral.py # Spectral filters (band math)
├── viz/
│ ├── __init__.py
│ ├── maps.py # Map visualization
│ └── charts.py # Statistical charts
└── utils/
├── __init__.py
└── helpers.py # Helper functions
Installation¶
Quick Start¶
import nickyspatial as ns
# Load a raster image
layer = ns.read_raster("path/to/your/satellite_image.tif")
# Perform segmentation
segments = ns.SlicSegmentation(scale=20, compactness=0.5)
segmented_layer = segments.execute(layer.raster, layer.transform, layer.crs)
# Calculate statistics
ns.attach_basic_stats(segmented_layer, "mean_intensity")
ns.attach_area_stats(segmented_layer)
ns.attach_spectral_indices(segmented_layer, indices=["ndvi"])
# Apply rules for classification
ruleset = ns.RuleSet(name="Land_Cover")
ruleset.add_rule(name="vegetation", condition="ndvi > 0.3 & area_units > 100")
classified_layer = ruleset.execute(segmented_layer, result_field="classification")
# Visualize results
ns.plot_layer_interactive(classified_layer, "classification")
Documentation¶
For detailed documentation and examples, see the documentation website. Deepwiki also provides documentation quite detailed , Do check it out if you like
Examples¶
Check out our comprehensive examples:
- Basic Usage: Complete workflow from loading data to visualization
- Supervised Classification: Machine learning-based classification with traditional algorithms
- CNN Classification: Deep learning approach using TensorFlow/Keras
- Interactive Demo: Web-based interface for exploring features
Key Features Demonstrated:¶
- Image Segmentation: SLIC algorithm for object-based analysis
- Statistical Analysis: Calculate spatial, spectral, and basic statistics
- Classification: Both traditional ML and deep learning approaches
- Rule Engine: Apply custom rules for object classification
- Visualization: Interactive maps and statistical charts
- I/O Operations: Read/write raster and vector formats
Contributing¶
Contributions are welcome! Follow dev setup guide & Please feel free to submit a Pull Request.
Acknowledgments¶
- Inspired by the functionality of eCognition and other OBIA methodologies
- Built on top of powerful open-source libraries like numpy, rasterio, scikit-image, and GeoPandas
- Nicky : Nicky is my belated dog and I named this package in his memory!