skimage.feature.hog(image, orientations=9, pixels_per_cell=(8, 8), cells_per_block=(3, 3), block_norm='L2-Hys', visualize=False, transform_sqrt=False, feature_vector=True, multichannel=None) [source]
 
Extract Histogram of Oriented Gradients (HOG) for a given image. Compute a Histogram of Oriented Gradients (HOG) by  (optional) global image normalization computing the gradient image in row and col
 computing gradient histograms normalizing across blocks flattening into a feature vector   Parameters 
 
image(M, N[, C]) ndarray 

Input image.  
orientationsint, optional 

Number of orientation bins.  
pixels_per_cell2-tuple (int, int), optional 

Size (in pixels) of a cell.  
cells_per_block2-tuple (int, int), optional 

Number of cells in each block.  
block_normstr {‘L1’, ‘L1-sqrt’, ‘L2’, ‘L2-Hys’}, optional 

Block normalization method:  
L1 

Normalization using L1-norm.  
L1-sqrt 

Normalization using L1-norm, followed by square root.  
L2 

Normalization using L2-norm.  
L2-Hys 

Normalization using L2-norm, followed by limiting the maximum values to 0.2 (Hys stands for hysteresis) and renormalization using L2-norm. (default) For details, see [3], [4].    
visualizebool, optional 

Also return an image of the HOG. For each cell and orientation bin, the image contains a line segment that is centered at the cell center, is perpendicular to the midpoint of the range of angles spanned by the orientation bin, and has intensity proportional to the corresponding histogram value.  
transform_sqrtbool, optional 

Apply power law compression to normalize the image before processing. DO NOT use this if the image contains negative values. Also see notes section below.  
feature_vectorbool, optional 

Return the data as a feature vector by calling .ravel() on the result just before returning.  
multichannelboolean, optional 

If True, the last image dimension is considered as a color channel, otherwise as spatial.    Returns 
 
out(n_blocks_row, n_blocks_col, n_cells_row, n_cells_col, n_orient) ndarray 

HOG descriptor for the image. If feature_vector is True, a 1D (flattened) array is returned.  
hog_image(M, N) ndarray, optional 

A visualisation of the HOG image. Only provided if visualize is True.     Notes The presented code implements the HOG extraction method from [2] with the following changes: (I) blocks of (3, 3) cells are used ((2, 2) in the paper); (II) no smoothing within cells (Gaussian spatial window with sigma=8pix in the paper); (III) L1 block normalization is used (L2-Hys in the paper). Power law compression, also known as Gamma correction, is used to reduce the effects of shadowing and illumination variations. The compression makes the dark regions lighter. When the kwarg transform_sqrt is set to True, the function computes the square root of each color channel and then applies the hog algorithm to the image. References  
1  
https://en.wikipedia.org/wiki/Histogram_of_oriented_gradients  
2  
Dalal, N and Triggs, B, Histograms of Oriented Gradients for Human Detection, IEEE Computer Society Conference on Computer Vision and Pattern Recognition 2005 San Diego, CA, USA, https://lear.inrialpes.fr/people/triggs/pubs/Dalal-cvpr05.pdf, DOI:10.1109/CVPR.2005.177  
3  
Lowe, D.G., Distinctive image features from scale-invatiant keypoints, International Journal of Computer Vision (2004) 60: 91, http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf, DOI:10.1023/B:VISI.0000029664.99615.94  
4  
Dalal, N, Finding People in Images and Videos, Human-Computer Interaction [cs.HC], Institut National Polytechnique de Grenoble - INPG, 2006, https://tel.archives-ouvertes.fr/tel-00390303/file/NavneetDalalThesis.pdf