Pages

Tuesday, September 27, 2011

HOG (Histogram of Oriented Gradients) with Matlab Implementation

Finally, I got time to blog again. I have moved this post to its new location on my site and I maintain the code there afterwards. Here is  the link:
-----------------------------------------------------------------------------------------------------------------
HOG introduced by (Dalal & Triggs, 2005) is a feature set for robust visual object recognition. 
They used HOG in human detection as a test case for their experiments. They reviewed existing edge and gradient based descriptors and showed experimentally that grids of Histograms of Oriented Gradient (HOG) descriptors had better performance among existing feature sets for human detection. 
They studied the influence of each stage of the computation on performance, concluding that, fine-scale gradients, fine orientation binning, relatively coarse spatial binning and high-quality local contrast normalization in overlapping descriptor blocks are all important for good results. 
I have implemented this nice feature set in MATLAB and you can download it from here.

The HOG method tiles the detector window with a dense grid of cells. Each cell contains a local histogram over orientation bins. At each pixel, the image gradient vector is calculated. The angle of the vector is used as a vote into the corresponding orientation bin and the vote is weighted by the gradient magnitude. Votes are accumulated over the pixels of each cell. The cells are grouped into blocks and a robust normalization process is run on each block to provide strong illumination invariance. 
The normalized histograms of all blocks are concatenated to give the window-level visual descriptor vector for learning. Spatial and angular linear interpolation, and in some cases Gaussian windowing over the block, are used during voting to reduce aliasing . The blocks overlap spatially so that each cell appears several times with different normalizations, as this typically improves performance.
Figure 1. HOG Feature Extraction



Figure 2. Image Gradients and Spatial/Orientation Binning.




 

 - Dalal, N., Triggs, B.: Histograms of Oriented Gradients for Human detection. In: CVPR 2005 (2005) (pdf)
 - D. Lowe. Distinctive Image Features from Scale-Invariant Keypoints. IJCV, 60(2):91–110, 2004. (pdf)

10 comments:

  1. Hi, would you please explain what type of input dose it accept? Thanks

    ReplyDelete
  2. Hello,
    your code has some problem,

    in some case , the denominator equals to zero,and the result becomes NAN!

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Hello,I can not download your code

    ReplyDelete
    Replies
    1. help please!!!
      caygun23@gmail.com

      Delete
    2. I have moved the post to a new blog
      you can download it here now
      http://farshbaf.net/en/artificial-intelligence/blog/hog-matlab-implementation

      Delete
  5. I have moved the post to a new blog. I will maintain the code there from now.
    http://farshbaf.net/en/artificial-intelligence/blog/hog-matlab-implementation

    ReplyDelete
  6. Harrah's Lake Tahoe - Mapyro
    Hotel Information. Harrah's Lake bet analysis Tahoe 군산 출장샵 - Mapyro features reviews, photos, The lake is home to over 속초 출장안마 6,000 acres of 서산 출장안마 natural beauty. 경상남도 출장마사지

    ReplyDelete
  7. The information published by you is very useful

    MATLAB Implementation

    Feel free to contact us.

    ReplyDelete