The SLIC algorithm was developped by researchers at EPFL in 2010.
It constrasted with the other competing State-of-the-Art superpixels segmentation algorithms because it was the fastest at the time and was easy to use, ie. it did not require many parameters to obtain a good segmentation.
In fact, the Simple Linear Iterative Clustering algorithm runs in O(N) time, compared to O(NlogN) or even O(N^2) for other methods.
A report (written in French) that gives more precise information about the algorithm is also available here.
makegcc- The
mogrifyCLI util is not required but it is highly encouraged to have it for easy image format conversion.
- Clone the repository
- Place desired
.ppmimage in thesrcdirectory and modifyNAME_IMG_INinmain.c. - Build using make
$ cd slic/src && make
- Run the executable
$ ./main
Below are some of the results obtained after running the SLIC aglorithm, based on n, the number of superpixels.
| Initial Image | n=256 |
n=512 |
n=1024 |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Contributions are more than welcome, simply clone the repository and open a PR.
This code is provided as is and may contain bugs, or not accurately transcribe the algorithm given in the original paper it is based on.











