I worked on Mean-Shift segmentation over this summer. This is a brief summary of my experience. Mean Shift Segmentation can only be best understood by reading the ‘Mean-Shift: A robust approach towards Feature Space Analysis’ by Dorin Comaniciu and Peter Meer who brought this old algorithm to life by applying it on images. I must say that the mathematics involved in the paper is not really your preliminary Calculus 101 so it’s a bit hard to understand. But over here let’s just say that the algorithm segments the image according to color, and not only that, it also gives a particular segment the ‘mean’ color of that entire segment. Already lost? Don’t worry you will understand when you see an example. Given below is an image and its mean shift segmented version.
There were still a few problems. Since EDISON was written in C some time ago, the latest Microsoft Visual Studio 2010 did not recognize a few protocols that were used because C has been updated as well. For example, the way in which certain data types were initiated and the way in which libraries were included in header files were no longer done that way. I had to update the entire code by searching over the internet for solutions to a number of problems which arose. Needless to say, correcting a code in this manner was extremely hard. Some problems were not even discussed on the internet and asking about them in online forums didn’t help one bit: no one ever replied. So I had to come up with solutions to those problems myself e.g. the use of the data type ‘byte’ which is not used these days.
After the problems of compiling the code through Matlab using Windows7 SDK, I finally had a working mean shift clustering and segmentation code. Compiling C files through Matlab is such an annoying task; you keep getting really pointless errors. My Matlab kept telling me I didn’t have the latest Microsoft Visual Studio installed, when it was right there on my desktop, fully installed and functional. Now how do you tell that to software? Well, you download a patch. This was because my version of Matlab was released before the Microsoft Visual Studio 2010 was released.
But it was all worthwhile, I got to study a very beautiful algorithm, I got to play with Matlab in ways I hadn’t known (my Matlab now says ‘Welcome to Ali’s Matlab’ on startup) and I got such beautiful results. So anyone who wants a working code for mean shift segmentation, email me at [email protected].
Ali