

Show HN: Image segmentation and background removal in JavaScript - secondtimeuse
https://github.com/AKSHAYUBHAT/ImageSegmentation

======
secondtimeuse
This is an alpha version, I hope to improve it over the next week by
incorporating ConvnetJS, to label pixels in mixed superpixels (Superpixels
with both positive and negative labels). And incorporate additional
functionality to such as blurring the boundary.

The current restriction on the size of canvas 640 X 640 (Instagram size) ,
will also be removed over next few updates.

~~~
me_bx
Congrats! Looks beautiful, makes the whole process so easy. This will save so
much time to many people.

------
MichaelApproved
It was hard to get an idea of the final result in the demo gif because the
last frame disappeared so quickly. Here it is
[http://imgur.com/fduYXCi](http://imgur.com/fduYXCi)

~~~
secondtimeuse
Thanks, I added it to the readme.

------
skstronghold
Was working on a similar problem, to fetch color of cloths from
images(including models and background) in an e-commerce website. This
implementation gives the best result so far.

~~~
secondtimeuse
Depending on the size of the object you are trying to segment relative to the
image, you can adjust the size of superpixels. To segment parts such as
clothes you can set large superpixel size by enabling developer option on top
right corner. You can also see superpixels rendered to understand which size
gives best results. This method can perform even approximate non-interactive
segmentation.

------
MichaelApproved
In the readme file, you have "License: Copyright 2015, Cornell University. All
Rights Reserved." Does that mean there isn't a public license to use it?

~~~
secondtimeuse
It will be released under Open Source compatible license, I just need to make
sure since I am a PhD student.

Note that the underlying algorithm implementations are MIT licensed.

[https://github.com/kyamagu/js-segment-
annotator/blob/master/...](https://github.com/kyamagu/js-segment-
annotator/blob/master/LICENSE)

------
pmontra
Great demo. Out of curiosity, why not compiling the C algorithm with emcc into
asm.js and probably get better performances (but a much larger js file) ?

~~~
secondtimeuse
Its actually based on [https://github.com/kyamagu/js-segment-
annotator](https://github.com/kyamagu/js-segment-annotator) which implements
two algorithm SLIC and PF.

Regarding compiling C using emscripten, I wanted a pure JS implementation so
that it was hackable using Chrome Developer tools, E.g. using LAB data
internally produced by SLIC algorithm. Hopefully in future, I will use a
emscripten implementation. It might be important for version that proceses
short gifs or videos.

Also there is a developer mode on top right, enabling it allows visualization
of superpixels and change parameters of the algorithm.

------
eonw
i tried to use it, it just crashed FireFox 39.0 on Windows 7.

------
dharma1
Great stuff. Anyone aware of Android libs for this?

~~~
secondtimeuse
OpenCV has GrabCut implementation which works on android. There are numerous
implementations of SLIC superpixels. Even this will work through a cordova
style wrapper, but I would really not recommend it, since you can use a much
faster and accurate native OpenCV on android.

