HOG特征描述算子
1)HOG特征的原始文獻
"Histograms of Oriented Gradients for Human Detection"?
"Finding People in Images and Videos" (PhD Thesis) (較為詳細)
2) HOG特征算子的網絡參考資料
http://www.cnblogs.com/tornadomeet/archive/2012/08/15/2640754.html
http://blog.csdn.net/carson2005/article/details/7841443#
http://blog.csdn.net/abcjennifer/article/details/7365651
http://blog.csdn.net/zouxy09/article/details/7929348#
HOG特征描述算子——原理、思路、步驟
-----------------------------------------------------------------------------------
1. HOG特征描述子的定義
HOG Descriptor:?locally normalised histogram of gradient orientation in dense overlapping grids,即局部歸一化的梯度方向直方圖。
2. HOG特征的基本思想
Histogram of Oriented Gradient descriptors provide a dense overlapping description of image regions,即統計圖像局部區域的梯度方向信息來作為該局部圖像區域的表征。
HOG有點類似于SIFT特征描述子,區別:?
1)HOG沒有選取主方向,也沒有旋轉梯度方向直方圖,因而本身不具有旋轉不變性(較大的方向變化),其rotate不變性是通過采用不同旋轉方向的訓練樣本來實現的;?
2)HOG本身不具有scale不變性,其scale不變性是通過改變檢測圖像的size來實現的;
3)HOG是在dense采樣的圖像塊中求取的,在計算得到的HOG特征向量中隱含了該塊與檢測窗口之間的空間位子關系,而SIFT特征向量是在一些獨立并離散分布的特征點上提取的(dense SIFT除外)。
3. HOG特征的假設和出發點
The hypothesis is that local object appearance and shape can often be characterised rather well by the distribution of local intensity gradient or edge directions, even without precise knowledge of the corresponding gradient or edge positions. 即,在圖像中,物體的局部外觀和形狀能夠通過其局部梯度或邊緣信息很好地表征和描述。
3. HOG特征描述向量的提取與計算步驟
HOG特征提取的流程圖如下圖所示:
1)全局圖像歸一化
目的:減少光照的影響
方法:gamma compression?
a) 對每個顏色通道分別,計算平方根,或者?
b) 對每個顏色通道分別,求log
2)計算圖像梯度
目的:通過梯度信息來描述圖像中物體的邊緣、輪廓、形狀等紋理信息
方法:對每個顏色通道分別計算梯度。梯度算子:水平邊緣算子: [-1, 0, 1] ;垂直邊緣算子: [-1, 0, 1]T 。
最后選擇三個通道中具有最大模值norm的梯度vector作為該像素的gradient vector。
3)統計局部圖像梯度信息
目的:統計局部圖像梯度信息并進行量化(或稱為編碼),得到局部圖像區域的特征描述向量。該特征描述算向量既能夠描述局部圖像的內容,又能夠對該圖像區域內的pose或外觀的小變化具有不變性。
方法:求取梯度方向直方圖
a)將image window劃分為多個區域“cell”;
b)為每個“cell”計算一個1-D的加權梯度方向直方圖;
其中,直方圖包含9個bin,劃分區間:0°-180°或0°-360°。
其中,加權采用三線性插值方法,即將當前像素的梯度方向大小、像素在cell中的x坐標與y坐標這三個值來作為插值權重,而被用來插入的值為像素的梯度幅值。
采用三線性插值的好處在于:避免了梯度方向直方圖在cell邊界和梯度方向量化的bin邊界處的突然變化。
4)歸一化
目的:對每個block得到的histogram進行歸一化后,能夠夠對光照、陰影、邊緣對比度等具有更好的不變性、
方法:
1)將多個臨近的cell組合成一個block塊,然后求其梯度方向直方圖向量;
2)采用L2-Norm with Hysteresis threshold方式進行歸一化,即將直方圖向量中bin值的最大值限制為0.2以下,然后再重新歸一化一次;
注意:block之間的是“共享”的,也即是說,一個cell會被多個block“共享”。另外,每個“cell”在被歸一化時都是“block”independent的,也就是說每個cell在其所屬的block中都會被歸一化一次,得到一個vector。
5)生成特征描述向量
即將所有“block”的HOG descriptors組合在一起,形成最終的feature vector,該feature vector就描述了detect window的圖像內容。
4. HOG描述算子的優點:
1)orientation histogram
能夠有效地描述圖像區域的local shape的特征信息
2)采用“cell”方式進行梯度方向量化,使得特征描述算子具有一些(a small amount of)平移或旋轉不變性
通過改變histogram的bin個數,以及“cell”的size,能夠控制捕獲圖像局部區域特征信息的精度和保持特征具有不變性
3)具有光照不變性
Gamma normalisation and local contrast normalisation(局部對比度歸一化) contribute another key component: illumination invariance.
4)overlapping blocks
The use of overlapping of blocks provides alternative normalisations so that the classifier can choose the most relevant one.
5.?影響HOG性能的幾個因素:
finescale gradients, fine orientation binning, relatively coarse spatial binning, and high-quality local contrast normalisation in overlapping descriptor blocks are all important for good performance.
6. ?解釋
1)為什么使用orientation histogram?
capture local shape information
2)為什么使用“cell”?
achieve a small amount of spatial invariance
3)為什么使用“overlapping blocks”?
在眾多的local contrast normalisation方法中,采用overlapping blocks得到的效果最好。
7. HOG代碼
OpenCV中包含了HOG特征的提取和描述類cv::HOGDescriptor。通過該類可以提取指定圖像區域的HOG特征。
相關內容:www.icvpr.com
--------------------------------------------------------
< 轉載請注明:http://blog.csdn.net/icvpr >
from: http://blog.csdn.net/icvpr/article/details/8454527
總結
- 上一篇: 关于HOG特征的一个Python代码
- 下一篇: Python numpy函数hstack