Histograms of Oriented Gradients
A mex function for calculating histograms of (oriented) gradients as described in the paper "Histograms of Oriented Gradients for Human Detection"[1]:
http://lear.inrialpes.fr/pubs/2005/DT05/
Function can be called with either one or two arguments :
hogs = HoG(Image,Params);
or
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 [1] 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 [1] 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"):
Cite As
Leo (2024). Histograms of Oriented Gradients (https://www.mathworks.com/matlabcentral/fileexchange/33863-histograms-of-oriented-gradients), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Image Processing and Computer Vision > Computer Vision Toolbox > Recognition, Object Detection, and Semantic Segmentation >
- MATLAB > Graphics > 2-D and 3-D Plots > Data Distribution Plots > Histograms >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.