Robust Hue Histogram
This is the source code for computing the robust hue histogram which is a robust color descriptor for local image patches proposed by van de Weijer and Schmid [1]. I have been using it for a while and its combination with an appearance descriptor, such as SIFT, can provide a good way of using color information for object/scene recognition type of applications.
The code is written in C++ and uses the fast numerical library of Blitz++. Therefore, in order to compile this code, you need to download and install Blitz++ from its website. Once you have Blitz++ installed, you can simply enter the source directory and type “make”. This will create a binary which you can use to extract robust hue histograms.
This code is release under the GNU GPL. Feel free to copy, modify, and distribute it according to the license. To obtain the latest version of GPL, please refer to http://www.gnu.org. Note that the original algorithm might be under a patent protection (I have not checked them with the authors). If you use this code for a publication, please make a reference to this web page.
- Download: Huehist-0.1.tar.gz (Release date: 4/10/2008)
Interface and Usage
The command line interface accepts following arguments:
- -h | help : will display the help message.
- -i : path to the input image (ppm format).
- -o : path to the output file.
- -k : path to the key points file.
- -bin : number of bins of histogram (default = 36).
- -smooth : number of smoothings (default = 2).
- -lambda : weight of the descriptor (default = 1).
- -scale : scale ratio (default = 1).
- -sigma : controls the sigma for the spatial weights (default = 0.5).
The interface is quite simple. It accepts an image in PPM format and a key points file which contains a set of interest points where you would like the descriptor to be computed. You can also optionally provide tuning parameters and also the output file name.
Each line in the key points file is an interest point in form of: x y s (anything after these three values will be ignored till next line). ‘x’ and ‘y’ are the key point location (x is over width and y is over height of the image). ‘s’ is the patch size, and its value will be multiplied by the scale ratio to obtain the final patch size. The example key points file in this package ‘test.key’, is the result of applying SIFT implementation to the test.ppm image (which produces DoG interest points and the corresponding SIFT descriptors). This file can be used with the huehist to get the additional color descriptors for the same interest points (though you should take care of the scale space and its relation to the patch sizes, which can be done by giving the correct scale ratio parameter, -scale, to this package).
The format of the output file follows the same format of the key points. Each line is the key point information (x, y, s) concatenated with the extracted hue histogram. If you do not specify the output file, the results will be written to a file by adding .hue extension to the key points file name.
Additionally, each pixel has a weighted effect on the histogram and the weights follow a 2-D Gaussian form centered at the location of the key point. The width of the Gaussian function is determined as the s*sigma/2, where s is the patch size (from the key points). Therefore, by adjusting the value of sigma, you can control how much the descriptor is focused on the center of the patch.
Examples:
- huehist -i test.ppm -k test.key -o test.hue -bin 24
- huehist -i test.ppm -k test.key -smooth 4 -lambda 0.6 -scale 10.0 -sigma 0.25
References: [1] J. van de Weijer, C. Schmid, ‘Coloring Local Feature Extraction’, ECCV 2006.