Randomized clustering of multidimensional data, with an application to image segmentation.
C++ C Haskell
Latest commit 619a312 Apr 2, 2012 Anthony Cowley Improved extension inspection for video file detection.
Removed commented-out obsolete srand call.

Improved comments describing how we decide whether or not to consider merging a component with its neighbors.
Failed to load latest commit information.


A library for randomized clustering of multidimensional data, with an application to image segmentation.

Prerequisite: OpenCV
Tested against version 2.3.1, but should be fairly easygoing compatibility-wise.

The demo program produces an executable that may be used three ways:

  • Running the executable with no arguments (e.g. ./segment) will attempt to open an attached webcam and segment the video stream.
  • Providing a video file as the argument (e.g. ./segment MyMovie.mp4) will play the movie in a window with the segmentation drawn over the video.
  • Providing an image file as the argument (e.g. ./segment MyImage.jpg) will produce (or overwrite) an image file coded.png in the current working directory.

Note that the segmentation is based entirely on color, and performance is impacted by image size. Since the underlying process is driven by a pseudorandom number generator, segmentations produced on consecutive runs of the program are very likely to be different, sometimes subtly so, sometimes not so subtly. These different segmentations will likely be of different subjective quality; repeated trials may be called for when using this as a frontend to further image analysis.

An example segmentation from the Berkeley dataset (computed in 41.3ms on a dual-core Core i5 laptop):

100099.jpg segmentation