Software and Source Code

  1. Matrix/Image Class Library in C#
  2. Gabor Feature Extraction in C#
  3. RGB to CIE-L*a*b* (vice versa) Color Space Conversion in C#
  4. Perona Malik Flow (Anisotropic Diffusion) Segmentation in C# (includes code for both color and gray-scale image segmentation)

 

    Matrix/Image Class Library in C#

Download the Visual Studio class library project here.

This is a core library I use for most of the C# code I include here (But all the code here are self-contained, so each of them already contain a copy of this library if needed). This is not a library for linear algebra, so it does not support (or intended to support) matrix multiplication or things like singular value decomposition, etc. (Can be easily added though). On the other hand, it is very useful for a graduate student starting up in image processing area. In most places, operator overloading, implicit/explicit type conversion and other useful ideas are used for creating easy to use and readable code. e.g.:

using Sumengen.Matrix;

...

DoubleMatrix im = DoubleMatrix.ReadImage("bird.bmp");
im -= im.Min();
double std = im.Std();
im /= std;

// Writes in double format without losing accuracy and can be read back later.
im.WriteRaw("scaled.raw"); 

...

While initially not intended to be used by third parties, I think there are many useful classes and functions in this library and could be an excellent starting point.
For a more complete Matrix/Vector/Linear algebra library that I have written in C++, see CIMPL.

 

    Gabor Texture Feature Extraction in C#

This code is based on Wei-Ying Ma's original code written in C.
Requires the following two zip files:
- Download the Visual Studio solution (includes example code/project to call the feature extraction). Extract the subdirectories somewhere in your computer. Open the .sln file within the "gabor" directory.
- Download the zip file for the supplemental DLL's. Extract the directory somewhere on your computer. Add this directory to the PATH environment (alternatively you can copy the dlls to the system32 directory).

GaborTest.cs gives an example of how to run the Gabor texture extraction. You might want to set createImageFiles to true for visualization purposes. It is a good idea to play with the parameters also.

Limitation: Due to some bug, I pad zeros to create square images for FFT, which means there is a slight inefficiency in terms of running time, but the results should be correct.

See: Manjunath B. S., Ma W. Y. Texture features for browsing and retrieval of image data. [Journal Paper] IEEE Transactions on Pattern Analysis & Machine Intelligence, vol.18, no.8, Aug. 1996, pp.837-42. Publisher: IEEE Comput. Soc, USA.
 

 

    RGB to CIE-L*a*b* (vice versa) Color Space Conversion in C#

This code is based on the code written by Yossi Rubner and Mark Ruzon.
Download here.
Lab is a good color space for edge detection and image segmentation type of applications. The Euclidean distances between individual colors reflect the perceived similarity (This is mainly true for similar colors. For dissimilar colors, Euclidean distance ordering is not as meaningful: see also http://robotics.stanford.edu/~ruzon/compass/).
 

    Perona Malik Flow (Anisotropic Diffusion) Segmentation in C# (includes code for both color and gray-scale image segmentation)

- Download the Visual Studio solution (includes example code/project to call the gray-scale and color segmentation). Extract the subdirectories somewhere in your computer. Open the .sln file within the "PeronaMalikFlow" directory.

PMTest.cs gives an example of how to run the segmentation for both using gray-scale and color features. In general (as most other C# code here), I didn't really bother optimizing for performance so it might be slow to some extend. Compile in "Release" mode for a speed increase.

See:  Perona P, Malik J. Scale-space and edge detection using anisotropic diffusion. [Journal Paper] IEEE Transactions on Pattern Analysis & Machine Intelligence, vol.12, no.7, July 1990, pp.629-39. USA.

See (for color): Sapiro G, Ringach D. L. Anisotropic diffusion of multivalued images with applications to color filtering. [Journal Paper] IEEE Transactions of Image Processing, vol.5, no.11, Nov. 1996, pp.1582-6. Publisher: IEEE, USA.