public class DescribeDenseHogAlg<Input extends ImageBase<Input>> extends BaseDenseHog<Input>
Implementation of the Histogram of Oriented Gradients (HOG)  dense feature descriptor. Several variants are described in the paper. The algorithm used here is the "R-HOG unsigned orientation" variant. The descriptor is computed from a regular grid of cells and an unsigned histogram is computed. Unsigned as in the angle is from 0 to 180 degrees instead of 0 to 360.This is a (hopefully) faithful implementation to the algorithm described in the paper. The descriptors are computed with the following steps.
- Compute image gradient using [-1,0,1] kernel
- Compute magnitude and orientation for each pixel
- For each pixel, spread out it's magnitude using interpolation.
- Normalize descriptor using SIFT style L2-Hys normalization
Cells and BlocksThe image is broken up into a regular grid of "cells". Every cell is square with a width of N pixels, where N is a user specified parameter. A block is a region composed of cells and is M by M cells in size. The size of the descriptor will be M by M by O, where O is the number of orientation histogram bins.
Orientation HistogramA histogram for each cell is computed. Ignoring interpolation, it would be computed by finding the magnitude and unsigned orientation of each pixel in the cell. Magnitude is defined as the Euclidean norm of the gradient and orientation is found to be 0 to PI radians. The bin for the orientation is found and the magnitude added to it. However, because of interpolation, each pixel contributes to multiple cells and orientation bins.
Interpolation and WeightingPer-pixel interpolation and weighting is applied when assigning a value to each orientation bin and cell. Linear interpolation is used for orientation. Bilinear interpolation for assigning values to each cell using the cell's center. Gaussian weighting is applied to each pixel with the center at each block. Each pixel can contribute up to 4 different histogram bins, and the all the pixels in a cell can contribute to the histogram of 9 cells.
Descriptor NormalizationFirst L2-normalization is applied to the descriptor. Then min(0.2,desc[i]) is applied to all elements in the descriptor. After which L2-normalization is applied again.
Accessing ResultsA list of descriptor and their locations is available. The location refers to the top-left most pixel in the region the descriptor is computed from. These lists are computed in a regular grid with row-major ordering. A request can be made for all descriptors computed from inside a rectangular region.
Multi-Band ImagesThe gradient is computed for each band individually. The band with the largest magnitude at that specific pixel is used as the gradient for the pixel.
 Dalal, Navneet, and Bill Triggs. "Histograms of oriented gradients for human detection." Computer Vision and Pattern Recognition, 2005. CVPR 2005.
Modifier and Type Method Description
()Compute gaussian weights applied to each pixel in the block
()Computes the descriptor across the input image
Input input)(Specifies input image.
Methods inherited from class boofcv.alg.feature.dense.BaseDenseHog
_getDerivX, _getDerivY, createDescription, getCellsPerBlockX, getCellsPerBlockY, getDescriptions, getImageType, getLocations, getOrientationBins, getPixelsPerCell, getRegionWidthPixelX, getRegionWidthPixelY, getStepBlock
DescribeDenseHogAlgpublic DescribeDenseHogAlg(int orientationBins, int pixelsPerCell, int cellsPerBlockX, int cellsPerBlockY, int stepBlock, ImageType<Input> imageType)Configures HOG descriptor computation
orientationBins- Number of bins in a cell's histogram. 9 recommended
pixelsPerCell- Number of pixel's wide a cell is. 8 recommended
cellsPerBlockX- Number of cells's wide a block is. x-axis 3 recommended
cellsPerBlockY- Number of cells's wide a block is. x-axis 3 recommended
stepBlock- Number of cells which are skipped between each block
computeWeightBlockPixelsprotected void computeWeightBlockPixels()Compute gaussian weights applied to each pixel in the block
setInputpublic void setInput(Input input)Specifies input image. Gradient is computed immediately
processpublic void process()Computes the descriptor across the input image