Saturday, July 13, 2013

Grabcut Algorithm in OpenCV

Hi friends,

Grabcut algorithm is a nice tool for foreground-background extraction with minimal user interface. It is developed by Microsoft research labs.

See one result below:

You start by drawing a rectangle around the foreground image. Algorithm then segments the image. There can be some misclassifications. There you provide some nice touchups specifying this area is background, this area is foreground etc. Again segment the image to get very nice results.

You can find a python sample at OpenCV source at this link. Watch a video demo of the same code below:

For more details of the algorithm and code, please visit my new tutorial repo:

Currently, no build is available, so please fork the repo, clone it and build it using sphinx. (Or download zip file if you don't have git account and then build it).

Sphinx installation is just one command with easy_install. Please visit here:

Abid K