Bienvenido al Blog de ANHIX

Bienvenido al Blog de ANHIX. Hola, les presento el blog de ANHIX. Estamos bajo construcción y pronto estaremos compartiendo contenido interesante!.

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




A SLIC Implementation in Pure Julia

The fastest superpixel segmentation now comes to Julia.

Image segmentation plays a great role in order to realize which objects construct an image. In order to reach this goal, people have invented a lot of strategies — one of which is superpixel.

Image segmentation is a process to classify which cluster each pixel should belong to. The goal of this is to let image more representative and easier for us to analyze. So far, people have invented a lot of techniques according to each characteristic of each object such as color, texture, and intensity, etc.

A clear representation of image segmentation. Image source: jeremyjordan.me

We use the properties of a pixel to classify which object it should belongs to. However, let me give you a question: is it proper to determine a range of an object in such small scale? Seems not. In 2003, Xiaofeng Ren and Jitendra Malik discussed about this problem and proposed superpixel. [1] The intuition of superpixel is pretty simple: rather than determine each pixel, we can group pixels with akin properties into a larger one — called superpixel — for further analyze. In this way, we not only get more meaningful regions but also improve computational efficiency. [2]

We can use some strategies to cluster pixels with similar properties into a superpixel such as graph theorem, gradient decent, or even machine learning methods. As the most well-known one of using machine learning method, SLIC comes to the place. The intuition of SLIC is pretty naive: we can set some seeds to cluster the surrounding pixels to form superpixels.

You will ask a problem: “It seems pretty straightforward. So what’s special of SLIC?” Rather than search all the pixels like normal K-means, SLIC uses a modified K-means which restricts the searching area into a certain space. To my opinion, SLIC adopts this way because each pixel surrounding to a center should have similar properties.

A comparison between normal K-means and SLIC modified K-means. Taken from [4]

SLIC just requires two input parameters:

And the simplified distance calculation is shown as follows:

Where S = sqrt(N/K) (N represents the number of pixels.)

The following lines describe the algorithm of SLIC.

As a new-born language, Julia grasps my sight because it is fast, dynamic, and general. Though SLIC has been implemented in various image processing libraries such as OpenCV and scikit-image, there are no any implementations in pure Julia, which seems a pity that we don’t use the benefits of this programming language.

In this post, I introduce the concept of image segmentation as well as the history of superpixel. Next, I make an introduction of SLIC superpixel and the algorithm. Last, I express why I want to implement SLIC in pure Julia and leave the link of my implementation.

For the future aspect, I will work on enforce connectivity after we generate the superpixel.

Add a comment

Related posts:

The poem that helped me leave Google for Harvard Business School

Google is a special company by every measure — in its scale, its people and its impact. The decision to move on wasn’t easy to make. However, the time has come to say see you later to the free food…

Can I Come In?

This story was inspired by the true unsolved murder of Kanika Powell in Maryland in 2008. You can hear more about it here. When the buzzer rang, Karolyn looked up from her computer in surprise. It…

Notes from Mexico City

It seems like everyone I know has fallen in love with Mexico City. All of a sudden this city is in every travel magazine and at the top of every friend’s recommendation list. It’s easy to understand…