A mex function for calculating histograms of (oriented) gradients as described in the paper "Histograms of Oriented Gradients for Human Detection":
Function can be called with either one or two arguments :
hogs = HoG(Image,Params);
hogs = HoG(Image);
Params should be a size 5 vector with:
Params(0) = number of orientation bins.
Params(1) = cell size.
Params(2) = block size.
Params(3) = 1 for oriented gradients and 0 otherwise.
Params(4) = value for clipping of the L2-norm.
See  for more details on these values.
If the function is called with only one parameter then the default values are used:
Params = [9 8 2 0 0.2];
Function can be called for both a RGB and grayscale image.
The function only supports data of type double, image data should first be cast into double i.e. HoG(double(Image)).
Finally  mentions the possibility of downweighting "pixels near the edges
of the block by applying a Gaussian spatial window..." and that this leads to and increase in performance of 1% at 10^-4 FPPW. This downweighting scheme is not used by this function.
The HoG function code is part of the MASH public descriptors ("heuristics"):