向梯度直方图(Histogram of Oriented Gradient, HOG)特征
2015-12-16 21:25
776 查看
The HOG features are widely use for object detection. HOG decomposes an image into small squared cells, computes an histogram of oriented gradients in each cell, normalizes the
result using a block-wise pattern, and return a descriptor for each cell.
Stacking the cells into a squared image region can be used as an image window descriptor for object detection, for example by means of an SVM.
This tutorial shows how to use the VLFeat function
compute HOG features of various kind and manipulate them.
An example image.
HOG is computed by calling the
The same function can also be used to generate a pictorial rendition of the features, although this unavoidably destroys some of the information contained in the feature itself. To this end, use the
This should produce the following image:
Standard HOG features with a cell size of eight pixels.
HOG is an array of cells, with the third dimension spanning feature components:
In this case the feature has 31 dimensions. HOG exists in many variants. VLFeat supports two: the UoCTTI variant (used by default) and the original Dalal-Triggs variant (with 2×2 square HOG blocks for normalization). The main difference is that
the UoCTTI variant computes bot directed and undirected gradients as well as a four dimensional texture-energy feature, but projects the result down to 31 dimensions. Dalal-Triggs works instead with undirected gradients only and does not do any compression,
for a total of 36 dimension. The Dalal-Triggs variant can be computed as
The result is visually very similar:
Dalal-Triggs variant. Differences with the standard version are difficult to appreciated in the rendition.
is obtained as follows:
Then these two examples produce identical results (provided that the image contains an exact number of cells:
This is shown in the figure:
Flipping HOG features from left to right either by flipping the input image or the features directly.
other parameters as well. For example, one can specify the number of orientations in the histograms by the
Changing the number of orientations changes the features quite significantly:
HOG features for
Another useful option is
in certain implementation like UoCTTI).
resulting in
From left to right: input image, hard orientation assigments for
from: http://www.vlfeat.org/overview/hog.html
result using a block-wise pattern, and return a descriptor for each cell.
Stacking the cells into a squared image region can be used as an image window descriptor for object detection, for example by means of an SVM.
This tutorial shows how to use the VLFeat function
vl_hogto
compute HOG features of various kind and manipulate them.
Basic HOG computation
We start by considering an example input image:An example image.
HOG is computed by calling the
vl_hogfunction:
cellSize = 8 ; hog = vl_hog(im, cellSize, 'verbose') ;
The same function can also be used to generate a pictorial rendition of the features, although this unavoidably destroys some of the information contained in the feature itself. To this end, use the
rendercommand:
imhog = vl_hog('render', hog, 'verbose') ; clf ; imagesc(imhog) ; colormap gray ;
This should produce the following image:
Standard HOG features with a cell size of eight pixels.
HOG is an array of cells, with the third dimension spanning feature components:
> size(hog) ans = 16 16 31
In this case the feature has 31 dimensions. HOG exists in many variants. VLFeat supports two: the UoCTTI variant (used by default) and the original Dalal-Triggs variant (with 2×2 square HOG blocks for normalization). The main difference is that
the UoCTTI variant computes bot directed and undirected gradients as well as a four dimensional texture-energy feature, but projects the result down to 31 dimensions. Dalal-Triggs works instead with undirected gradients only and does not do any compression,
for a total of 36 dimension. The Dalal-Triggs variant can be computed as
% Dalal-Triggs variant cellSize = 8 ; hog = vl_hog(im, cellSize, 'verbose', 'variant', 'dalaltriggs') ; imhog = vl_hog('render', hog, 'verbose', 'variant', 'dalaltriggs') ;
The result is visually very similar:
Dalal-Triggs variant. Differences with the standard version are difficult to appreciated in the rendition.
Flipping HOG from left to right
Often it is necessary to flip HOG features from left to right (for example in order to model an axis symmetric object). This can be obtained analytically from the feature itself by permuting the histogram dimensions appropriately. The permutationis obtained as follows:
% Get permutation to flip a HOG cell from left to right perm = vl_hog('permutation') ;
Then these two examples produce identical results (provided that the image contains an exact number of cells:
imHog = vl_hog('render', hog) ; imHogFromFlippedImage = vl_hog('render', hogFromFlippedImage) ; imFlippedHog = vl_hog('render', flippedHog) ;
This is shown in the figure:
Flipping HOG features from left to right either by flipping the input image or the features directly.
Other HOG parameters
vl_hogsupports
other parameters as well. For example, one can specify the number of orientations in the histograms by the
numOrientationsoption:
% Specify the number of orientations hog = vl_hog(im, cellSize, 'verbose', 'numOrientations', o) ; imhog = vl_hog('render', hog, 'verbose', 'numOrientations', o) ;
Changing the number of orientations changes the features quite significantly:
HOG features for
numOrientationsequal to 3, 4, 5, 9, and 21 repsectively.
Another useful option is
BilinearOrientationsswitching on the bilinear orientation assignment of the gradient (this is not used
in certain implementation like UoCTTI).
% Specify the number of orientations hog = vl_hog(im,cellSize,'numOrientations', 4) ; imhog = vl_hog('render', hog, 'numOrientations', 4) ;
resulting in
From left to right: input image, hard orientation assigments for
numOrientationsequals to four, and soft orientation assigments.
from: http://www.vlfeat.org/overview/hog.html
相关文章推荐
- 智能防火墙的技术特征
- Java面向对象的三大特征
- “黑心”公司15大特征,你们公司占几项
- 五大常用算法之分治法
- OpenCV中HOG特征的提取实现
- 2013织梦CMS被挂马特征汇总
- Histograms of Oriented Gradients for Human Detection
- Hog SVM 车辆识别
- 基于HOG特征和Neural network的人脸检测
- 话务预测(6) 时间序列特征
- peopledetect.cpp demo
- matlab实现的手写体字符截取字符区域的方法
- HOG特征-理解篇
- HOG参数简介及Hog特征维数的计算
- BP单隐层神经网络 代码实现 以及 详细步骤
- 高IQ孩子的特征[图]
- 特征选择方法之信息增益
- Haar-like特征
- 【特征工程系列3】Zipf定律及其特征化
- 操作系统概念及特征