Documentation of 'boofcv.alg.feature.dense.DescribeDenseHogAlg' Java class
DescribeDenseHogAlg
boofcv.alg.feature.dense

Class DescribeDenseHogAlg<Input extends ImageBase,Derivative extends ImageBase>

  • Direct Known Subclasses:
    DescribeDenseHogAlg_F32, DescribeDenseHogAlg_PLF32, DescribeDenseHogAlg_PLU8, DescribeDenseHogAlg_U8


    public abstract class DescribeDenseHogAlg<Input extends ImageBase,Derivative extends ImageBase>
    extends java.lang.Object

    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 "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.
    1. Compute image gradient using [-1,0,1] kernel
    2. Compute histogram for each cell in the image
    3. Compute descriptor from blocks of cells
    4. Normalize descriptor using SIFT style L2-Hys normalization

    Cell Histogram

    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. Within each cell a histogram is computed. The number of histogram bins B is specified by the user. The histogram is created by computing the Euclidean norm for each pixel's gradient inside the cell and then using bilinear interpolation to put it into the two neighboring bins which best match its angle.

    Descriptor Blocks

    Square blocks, which are M cells wide, are used to compute each descriptor. The histogram is copied into a TupleDesc_F64 in a row-major fashion and a weight is applied. The weight is specified for each cell based on its distance from the block's center. Gaussian weight is used with a standard deviation of 0.5*block_width. Note that blocks do overlap. See paper for details.

    Descriptor Normalization

    First 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 Results

    A 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 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.

    • Constructor Detail

      • DescribeDenseHogAlg

        public DescribeDenseHogAlg(int orientationBins,
                                   int widthCell,
                                   int widthBlock,
                                   int stepBlock,
                                   ImageType<Input> imageType)
        Configures HOG descriptor computation
        Parameters:
        orientationBins - Number of bins in a cell's histogram. 9 recommended
        widthCell - Number of pixel's wide a cell is. 8 recommended
        widthBlock - Number of cells's wide a black is. 3 recommended
        stepBlock - Number of cells which are skipped between each block
    • Method Detail

      • setInput

        public void setInput(Input input)
        Specifies input image. Gradient is computed immediately
        Parameters:
        input - input image
      • process

        public void process()
        Computes the descriptor across the input image
      • getDescriptorsInRegion

        public void getDescriptorsInRegion(int pixelX0,
                                           int pixelY0,
                                           int pixelX1,
                                           int pixelY1,
                                           java.util.List<TupleDesc_F64> output)
        Convenience function which returns a list of all the descriptors computed inside the specified region in the image
        Parameters:
        pixelX0 - Pixel coordinate X-axis lower extent
        pixelY0 - Pixel coordinate Y-axis lower extent
        pixelX1 - Pixel coordinate X-axis upper extent
        pixelY1 - Pixel coordinate Y-axis upper extent
        output - List of descriptions
      • computeDerivative

        public abstract void computeDerivative(int pixelIndex)
        Computes and stores the gradient at the specified pixel. pixelIndex = y*columns + x
      • getLocations

        public FastQueue<Point2D_I32> getLocations()
        List of locations for each descriptor.
      • _getPixelDX

        public float _getPixelDX()
      • _getPixelDY

        public float _getPixelDY()
      • getRegionWidthPixel

        public int getRegionWidthPixel()
        Returns the number of pixel's wide the square region is that a descriptor was computed from
        Returns:
        number of pixels wide
      • setWidthCell

        public void setWidthCell(int widthCell)
      • getWidthCell

        public int getWidthCell()
      • getWidthBlock

        public int getWidthBlock()
      • getStepBlock

        public int getStepBlock()
      • getOrientationBins

        public int getOrientationBins()
      • getCellRows

        public int getCellRows()
      • getCellCols

        public int getCellCols()
      • setStepBlock

        public void setStepBlock(int stepBlock)

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.