Package boofcv.alg.feature.dense
Class DescribeDenseHogAlg<Input extends ImageBase<Input>>
java.lang.Object
boofcv.alg.feature.dense.BaseDenseHog<Input>
boofcv.alg.feature.dense.DescribeDenseHogAlg<Input>
Implementation of the Histogram of Oriented Gradients (HOG) [1] dense feature descriptor. Several variants are described in the paper. The algorithm used here is the "RHOG 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 L2Hys normalization
Cells and Blocks
The 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 Histogram
A 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 Weighting
Perpixel 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 Normalization
First L2normalization is applied to the descriptor. Then min(0.2,desc[i]) is applied to all elements in the descriptor. After which L2normalization is applied again.Accessing Results
A list of descriptor and their locations is available. The location refers to the topleft most pixel in the region the descriptor is computed from. These lists are computed in a regular grid with rowmajor ordering. A request can be made for all descriptors computed from inside a rectangular region.MultiBand Images
The 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.[1] Dalal, Navneet, and Bill Triggs. "Histograms of oriented gradients for human detection." Computer Vision and Pattern Recognition, 2005. CVPR 2005.

Field Summary
Fields inherited from class boofcv.alg.feature.dense.BaseDenseHog
derivX, derivY

Constructor Summary
ConstructorDescriptionDescribeDenseHogAlg
(int orientationBins, int pixelsPerCell, int cellsPerBlockX, int cellsPerBlockY, int stepBlock, ImageType<Input> imageType) Configures HOG descriptor computation 
Method Summary
Modifier and TypeMethodDescriptionprotected void
Compute gaussian weights applied to each pixel in the blockvoid
process()
Computes the descriptor across the input imagevoid
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

Field Details

orientation

magnitude


Constructor Details

DescribeDenseHogAlg
public DescribeDenseHogAlg(int orientationBins, int pixelsPerCell, int cellsPerBlockX, int cellsPerBlockY, int stepBlock, ImageType<Input> imageType) Configures HOG descriptor computation Parameters:
orientationBins
 Number of bins in a cell's histogram. 9 recommendedpixelsPerCell
 Number of pixel's wide a cell is. 8 recommendedcellsPerBlockX
 Number of cells's wide a block is. xaxis 3 recommendedcellsPerBlockY
 Number of cells's wide a block is. xaxis 3 recommendedstepBlock
 Number of cells which are skipped between each block


Method Details

computeWeightBlockPixels
protected void computeWeightBlockPixels()Compute gaussian weights applied to each pixel in the block 
setInput
Specifies input image. Gradient is computed immediately Overrides:
setInput
in classBaseDenseHog<Input extends ImageBase<Input>>
 Parameters:
input
 input image

process
public void process()Computes the descriptor across the input image Specified by:
process
in classBaseDenseHog<Input extends ImageBase<Input>>
