https://github.com/tensor-fusion/slic-superpixels
SLIC (Simple Linear Iterative Clustering) Superpixels for pixel clustering and segmentation
https://github.com/tensor-fusion/slic-superpixels
computer-vision image-processing image-segmentation superpixel-segmentation
Last synced: 8 months ago
JSON representation
SLIC (Simple Linear Iterative Clustering) Superpixels for pixel clustering and segmentation
- Host: GitHub
- URL: https://github.com/tensor-fusion/slic-superpixels
- Owner: tensor-fusion
- Created: 2024-04-04T19:09:44.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-04T20:25:40.000Z (about 2 years ago)
- Last Synced: 2025-01-10T16:24:02.184Z (over 1 year ago)
- Topics: computer-vision, image-processing, image-segmentation, superpixel-segmentation
- Language: Jupyter Notebook
- Homepage:
- Size: 4.55 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SLIC (Simple Linear Iterative Clustering) Superpixels
Paper: https://www.cs.jhu.edu/~ayuille/JHUcourses/VisionAsBayesianInference2022/4/Achanta_SLIC_PAMI2012.pdf
## Background
Superpixels are just small regions of an image.
Superpixels-based algorithms group pixels based on color and spatial proximity into perceptually meaningful regions while respecting potential object contours, and thereby can replace the rigid pixel grid structure. They serve as a more meaningful and efficient representation of images compared to individual pixels, and can reduce the complexity of image processing tasks.
Used in computer vision stuff like object detection, image segmentation, image editing, etc.
## SLIC Superpixels
SLIC (Simple Linear Iterative Clustering) is an efficient algorithm for generating superpixels. It is based on a modified k-means clustering approach, considering both color and spatial information.

## Distance function
The minimized distance function considers both color similarity and spatial proximity:
$D=\sqrt{\left(\frac{d_c}{m}\right)^2+\left(\frac{d_s}{S}\right)^2}$
Where:
- $D$ is the combined distance.
- $d_c$ is the color distance in the CIELAB color space.
- $d_s$ is the spatial distance.
- $m$ is a compactness parameter that controls the trade-off between color and spatial proximity.
- $S$ is the grid interval, approximately equal to the square root of the image area divided by the desired number of superpixels.
## Algorithm
- **Initialization**: Cluster centers are formed at grid intervals and moved to lowest gradient position within some neighborhood.
- **Assignment**: Pixels are assigned to the nearest cluster center applying the distance function.
- **Update**: Update cluster centers to pixels mean.
- **Iteration**: Repeat until convergence.