Thursday, October 14, 2010

Super Parsing

This is my first Computer Vision related post. Hopefully, the first of many to come.

I wanted to try out the "SuperParsing" (ECCV 2010) code to segment some of the Street View Panoramas that I have. The code is available for download from here:>

However to build the code, there are several dependencies that need to be installed. The first amongst them is the "Efficient Graph-Based Image Segmentation" code. This code can be downloaded from here:

In this post, I am logging the small problems I faced while executing the above code and how I overcame them.

1. Building the code is straightforward. A simple "make" does the job.

2. The code expects an input image in the PPM format. If you are new to the PPM format (like I was), here is the complete specifications:

Well, I had my input image in the PNG format. Here is the PNG image (a street view panorama):

To convert it to PPM format, I used ImageMagick's "convert" command. ImageMagick can be downloaded from here

But the problem is that the segmentation code expects an 8-bit image (0 - 255). So, this has to be specifically mentioned while using the convert command. Also, in case the input image is too big, you can resize while converting it.

$ convert input.png -depth 8 -resize 50% input.ppm

Now we are all set to run the segmentation code. The arguments below are as given in the README file:

$ ./segment 0.5 500 20 input.ppm output.ppm
loading input image.
got 2468 components
done! uff...thats hard work.

Now we can convert the segmented image back to the (more) standard PNG format.

$ convert output.ppm output.png

Here is the output segmented image:

Thats nice! Ok, more to come later...