scikit-image/scikit-image — pull request #857 by guillempalou (2013-12-20 08:21:38+00:00)
Title: Enforce SLIC superpixels connectivity

A Breath-First search algorithm is implemented to enforce superpixel connectivity. The algorithm follows the same techniques as in the original paper: "R.Achanta et al. SLIC Superpixels Compared to State-of-the-art Superpixel Methods, IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 34, num. 11, p. 2274 - 2282, May 2012.":

1. Loop through all the image
2. Get the size of a connected component (adjacent pixels with same label)
3. If the size is less than a threshold, merge it to an adjacent cluster

At the end, the generated superpixels are 4-connected (or 6 in 3 dimensions)