Module ImportFrom alias Import alias identifier ImportFrom alias ImportFrom alias Import alias FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Num TupleLoad Num Num TupleLoad Num Num NameLoad NameLoad NameLoad NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Str Expr Call NameLoad NameLoad Num If CompareIsNot NameLoad NameLoad body Raise Call NameLoad Str If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Str If CompareEq AttributeLoad AttributeLoad NameLoad attr attr Str body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr Assign SubscriptStore NameLoad ExtSlice Slice Index Num Num Assign SubscriptStore NameLoad ExtSlice Slice Index Num Num Assign SubscriptStore NameLoad ExtSlice Slice Slice Num Num BinOpSub SubscriptLoad NameLoad ExtSlice Slice Slice Num SubscriptLoad NameLoad ExtSlice Slice Slice Num Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr Assign SubscriptStore NameLoad ExtSlice Index Num Slice Num Assign SubscriptStore NameLoad ExtSlice Index Num Slice Num Assign SubscriptStore NameLoad ExtSlice Slice Num Num Slice BinOpSub SubscriptLoad NameLoad ExtSlice Slice Num Slice SubscriptLoad NameLoad ExtSlice Slice Num Slice Expr Str Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore NameLoad Assign TupleStore NameStore NameStore NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr BinOpFloorDiv NameLoad NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr BinOpFloorDiv NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore NameLoad If NameLoad body ImportFrom alias Assign NameStore BinOpSub BinOpFloorDiv Call NameLoad NameLoad NameLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpMult NameLoad Call AttributeLoad NameLoad attr BinOpMult BinOpDiv NameLoad NameLoad AttributeLoad NameLoad attr Assign NameStore BinOpMult NameLoad Call AttributeLoad NameLoad attr BinOpMult BinOpDiv NameLoad NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad keyword NameLoad For NameStore Call NameLoad NameLoad body For NameStore Call NameLoad NameLoad body For TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad ListLoad BinOpAdd BinOpMult NameLoad NameLoad BinOpFloorDiv NameLoad Num BinOpAdd BinOpMult NameLoad NameLoad BinOpFloorDiv NameLoad Num Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Call NameLoad BinOpSub SubscriptLoad NameLoad Index Num NameLoad Call NameLoad BinOpAdd SubscriptLoad NameLoad Index Num NameLoad Call NameLoad BinOpAdd SubscriptLoad NameLoad Index Num NameLoad Call NameLoad BinOpSub SubscriptLoad NameLoad Index Num NameLoad AugAssignAdd SubscriptStore NameLoad Index TupleLoad NameLoad NameLoad SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad NameLoad Expr Str Assign NameStore BinOpAdd BinOpSub NameLoad NameLoad Num Assign NameStore BinOpAdd BinOpSub NameLoad NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad NameLoad NameLoad NameLoad For NameStore Call NameLoad NameLoad body For NameStore Call NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad ExtSlice Slice NameLoad BinOpAdd NameLoad NameLoad Slice NameLoad BinOpAdd NameLoad NameLoad Slice Assign NameStore Num Assign SubscriptStore NameLoad ExtSlice Index NameLoad Index NameLoad Slice BinOpDiv NameLoad Call AttributeLoad NameLoad attr BinOpAdd BinOpPow Call AttributeLoad NameLoad attr Num NameLoad Expr Str If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If NameLoad body Return TupleLoad NameLoad NameLoad orelse Return NameLoad decorator_list
N/A __future__ division N/A numpy np _shared.utils assert_nD N/A _hoghistogram N/A warnings hog N/A N/A image orientations pixels_per_cell cells_per_block visualise transform_sqrt feature_vector normalise N/A 9 N/A 8 8 N/A 3 3 False False True None N/A N/A Extract Histogram of Oriented Gradients (HOG) for a given image.

    Compute a Histogram of Oriented Gradients (HOG) by

        1. (optional) global image normalisation
        2. computing the gradient image in x and y
        3. computing gradient histograms
        4. normalising across blocks
        5. flattening into a feature vector

    Parameters
    ----------
    image : (M, N) ndarray
        Input image (greyscale).
    orientations : int
        Number of orientation bins.
    pixels_per_cell : 2 tuple (int, int)
        Size (in pixels) of a cell.
    cells_per_block  : 2 tuple (int,int)
        Number of cells in each block.
    visualise : bool, optional
        Also return an image of the HOG.
    transform_sqrt : bool, optional
        Apply power law compression to normalise the image before
        processing. DO NOT use this if the image contains negative
        values. Also see `notes` section below.
    feature_vector : bool, optional
        Return the data as a feature vector by calling .ravel() on the result
        just before returning.
    normalise : bool, deprecated
        The parameter is deprecated. Use `transform_sqrt` for power law
        compression. `normalise` has been deprecated.

    Returns
    -------
    newarr : ndarray
        HOG for the image as a 1D (flattened) array.
    hog_image : ndarray (if visualise=True)
        A visualisation of the HOG image.

    References
    ----------
    * http://en.wikipedia.org/wiki/Histogram_of_oriented_gradients

    * 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

    Notes
    -----
    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.
     N/A image N/A N/A np atleast_2d image N/A 
    The first stage applies an optional global image normalisation
    equalisation that is designed to reduce the influence of illumination
    effects. In practice we use gamma (power law) compression, either
    computing the square root or the log of each colour channel.
    Image texture strength is typically proportional to the local surface
    illumination so this compression helps to reduce the effects of local
    shadowing and illumination variations.
     N/A N/A assert_nD image 2 N/A N/A normalise None N/A N/A N/A ValueError The normalise parameter was removed due to incorrect behavior; it only applied a square root instead of a true normalization. If you wish to duplicate the old behavior, set ``transform_sqrt=True``. N/A transform_sqrt N/A N/A image N/A N/A np sqrt image N/A 
    The second stage computes first order image gradients. These capture
    contour, silhouette and some texture information, while providing
    further resistance to illumination variations. The locally dominant
    colour channel is used, which provides colour invariance to a large
    extent. Variant methods may also include second order image derivatives,
    which act as primitive bar detectors - a useful feature for capturing,
    e.g. bar like structures in bicycles and limbs in humans.
     N/A N/A N/A N/A image dtype kind u N/A N/A image N/A N/A image astype float N/A gx N/A N/A np empty N/A image shape dtype N/A np double N/A N/A gx N/A N/A N/A 0 0 N/A N/A gx N/A N/A N/A -1 0 N/A N/A gx N/A N/A N/A 1 -1 N/A N/A image N/A N/A N/A 2 N/A image N/A N/A N/A -2 N/A gy N/A N/A np empty N/A image shape dtype N/A np double N/A N/A gy N/A N/A 0 N/A 0 N/A N/A gy N/A N/A -1 N/A 0 N/A N/A gy N/A N/A 1 -1 N/A N/A N/A image N/A N/A 2 N/A N/A image N/A N/A -2 N/A N/A 
    The third stage aims to produce an encoding that is sensitive to
    local image content while remaining resistant to small changes in
    pose or appearance. The adopted method pools gradient orientation
    information locally in the same way as the SIFT [Lowe 2004]
    feature. The image window is divided into small spatial regions,
    called "cells". For each cell we accumulate a local 1-D histogram
    of gradient or edge orientations over all the pixels in the
    cell. This combined cell-level 1-D histogram forms the basic
    "orientation histogram" representation. Each orientation histogram
    divides the gradient angle range into a fixed number of
    predetermined bins. The gradient magnitudes of the pixels in the
    cell are used to vote into the orientation histogram.
     N/A N/A sy sx N/A image shape N/A N/A cx cy pixels_per_cell N/A N/A bx by cells_per_block N/A n_cellsx N/A int N/A N/A np floor N/A sx cx N/A n_cellsy N/A int N/A N/A np floor N/A sy cy N/A orientation_histogram N/A N/A np zeros N/A n_cellsy n_cellsx orientations N/A N/A N/A _hoghistogram hog_histograms gx gy cx cy sx sy n_cellsx n_cellsy orientations orientation_histogram N/A hog_image None N/A visualise N/A N/A draw N/A radius N/A N/A N/A min cx cy 2 1 N/A orientations_arr N/A N/A np arange orientations N/A dx_arr N/A radius N/A N/A np cos N/A N/A orientations_arr orientations N/A np pi N/A dy_arr N/A radius N/A N/A np sin N/A N/A orientations_arr orientations N/A np pi N/A hog_image N/A N/A np zeros N/A sy sx dtype float N/A x N/A range n_cellsx N/A N/A y N/A range n_cellsy N/A N/A N/A o dx dy N/A zip orientations_arr dx_arr dy_arr N/A N/A centre N/A tuple N/A N/A N/A y cy N/A cy 2 N/A N/A x cx N/A cx 2 N/A N/A rr cc N/A N/A draw line N/A int N/A N/A centre N/A 0 dx N/A int N/A N/A centre N/A 1 dy N/A int N/A N/A centre N/A 0 dx N/A int N/A N/A centre N/A 1 dy N/A N/A hog_image N/A N/A rr cc N/A orientation_histogram N/A N/A y x o N/A 
    The fourth stage computes normalisation, which takes local groups of
    cells and contrast normalises their overall responses before passing
    to next stage. Normalisation introduces better invariance to illumination,
    shadowing, and edge contrast. It is performed by accumulating a measure
    of local histogram "energy" over local groups of cells that we call
    "blocks". The result is used to normalise each cell in the block.
    Typically each individual cell is shared between several blocks, but
    its normalisations are block dependent and thus different. The cell
    thus appears several times in the final output vector with different
    normalisations. This may seem redundant but it improves the performance.
    We refer to the normalised block descriptors as Histogram of Oriented
    Gradient (HOG) descriptors.
     N/A n_blocksx N/A N/A n_cellsx bx 1 N/A n_blocksy N/A N/A n_cellsy by 1 N/A normalised_blocks N/A N/A np zeros N/A n_blocksy n_blocksx by bx orientations N/A x N/A range n_blocksx N/A N/A y N/A range n_blocksy N/A N/A block N/A orientation_histogram N/A N/A y N/A y by N/A x N/A x bx N/A N/A eps 1e-05 N/A N/A normalised_blocks N/A N/A y N/A x N/A N/A block N/A N/A np sqrt N/A N/A N/A N/A block sum 2 eps N/A 
    The final step collects the HOG descriptors from all blocks of a dense
    overlapping grid of blocks covering the detection window into a combined
    feature vector for use in the window classifier.
     N/A feature_vector N/A N/A normalised_blocks N/A N/A normalised_blocks ravel N/A visualise N/A N/A N/A normalised_blocks hog_image N/A N/A normalised_blocks N/A