Class HistogramOfOrientedGradients

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class HistogramOfOrientedGradients
    extends AlgorithmBase
    Copyright (C) 2007-11, Andrea Vedaldi and Brian Fulkerson Copyright (C) 2012-13, The VLFeat Team All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    • Constructor Detail

      • HistogramOfOrientedGradients

        public HistogramOfOrientedGradients()
      • HistogramOfOrientedGradients

        public HistogramOfOrientedGradients​(ModelImage image)
    • Method Detail

      • vl_hog_new

        public HistogramOfOrientedGradients.VlHog vl_hog_new​(HistogramOfOrientedGradients.VlHogVariant variant,
                                                             int numOrientations,
                                                             boolean transposed)
        Parameters:
        variant - HOG descriptor variant.
        numOrientations - number of distinguished orientations.
        transposed - wether images are transposed (column major).
        Returns:
        the new HOG object. The function creates a new HOG object to extract descriptors of the prescribed @c variant. The angular resolution is set by
      • vl_hog_get_glyph_size

        public int vl_hog_get_glyph_size​(HistogramOfOrientedGradients.VlHog self)
        Parameters:
        self - HOG object.
        Returns:
        size (height and width) of a glyph.
      • vl_hog_get_permutation

        public int[] vl_hog_get_permutation​(HistogramOfOrientedGradients.VlHog self)
        Parameters:
        self - HOG object.
        Returns:
        left-right permutation. The function returns a pointer to an array @c permutation of ::vl_hog_get_dimension elements. Given a HOG descriptor (for a cell) @c hog, which is also a vector of ::vl_hog_get_dimension elements, the descriptor obtained for the same image flipped horizotnally is given by flippedHog[i] = hog[permutation[i]].
      • vl_hog_set_use_bilinear_orientation_assignments

        public void vl_hog_set_use_bilinear_orientation_assignments​(HistogramOfOrientedGradients.VlHog self,
                                                                    boolean x)
        Parameters:
        self - HOG object.
        x -
      • vl_hog_get_use_bilinear_orientation_assignments

        public boolean vl_hog_get_use_bilinear_orientation_assignments​(HistogramOfOrientedGradients.VlHog self)
        Parameters:
        self - HOG object.
        Returns:
      • vl_hog_render

        public void vl_hog_render​(HistogramOfOrientedGradients.VlHog self,
                                  float[] image,
                                  float[] descriptor,
                                  int height,
                                  int width)
        Parameters:
        self - HOG object.
        image - glyph image (output).
        descriptor - HOG descriptor.
        width - HOG descriptor width.
        height - HOG descriptor height. The function renders the HOG descriptor or filter
      • vl_hog_get_dimension

        public int vl_hog_get_dimension​(HistogramOfOrientedGradients.VlHog self)
        Parameters:
        self - HOG object.
        Returns:
        dimension of a HOG cell descriptors.
      • vl_hog_get_width

        public int vl_hog_get_width​(HistogramOfOrientedGradients.VlHog self)
        Parameters:
        self - HOG object.
        Returns:
        number of HOG cells in the horizontal direction.
      • vl_hog_get_height

        public int vl_hog_get_height​(HistogramOfOrientedGradients.VlHog self)
        Parameters:
        self - HOG object.
        Returns:
        number of HOG cells in the vertical direction.
      • vl_hog_prepare_buffers

        public void vl_hog_prepare_buffers​(HistogramOfOrientedGradients.VlHog self,
                                           int width,
                                           int height,
                                           int cellSize)
        Parameters:
        self - HOG object.
        width - image width.
        height - image height.
        cellSize - size of a HOG cell.
      • vl_hog_put_image

        public void vl_hog_put_image​(HistogramOfOrientedGradients.VlHog self,
                                     float[] image,
                                     int height,
                                     int width,
                                     int numChannels,
                                     int cellSize)
        Parameters:
        self - HOG object.
        image - image to process.
        width - image width.
        height - image height.
        numChannels - number of image channles.
        cellSize - size of a HOG cell. The buffer @c hog must be a three-dimensional array. The first two dimensions are @c (width + cellSize/2)/cellSize and
      • vl_hog_put_polar_field

        public void vl_hog_put_polar_field​(HistogramOfOrientedGradients.VlHog self,
                                           float[] modulus,
                                           float[] angle,
                                           boolean directed,
                                           int height,
                                           int width,
                                           int cellSize)
        Parameters:
        self - HOG object.
        modulus - image gradient modulus.
        angle - image gradient angle.
        directed - wrap the gradient angles at 2pi (directed) or pi (undirected).
        width - image width.
        height - image height.
        cellSize - size of a HOG cell. The function behaves like ::vl_hog_put_image, but foregoes the internal computation of the gradient field, allowing the user to specify their own. Angles are measure clockwise, the y axis pointing downwards, starting from the x axis (pointing to the right).
      • vl_hog_extract

        public void vl_hog_extract​(HistogramOfOrientedGradients.VlHog self,
                                   float[] features)
        Parameters:
        self - HOG object.
        features - HOG features (output). This method is called after ::vl_hog_put_image or ::vl_hog_put_polar_field in order to retrieve the computed HOG features. The buffer @c features must have the dimensions returned by ::vl_hog_get_width, ::vl_hog_get_height, and ::vl_hog_get_dimension.
      • test_basic_call

        public void test_basic_call()
      • test_bilinear_operations

        public void test_bilinear_operations()
      • test_variants_and_flipping

        public void test_variants_and_flipping()
      • test_polar

        public void test_polar()
      • vl_hog

        public float[][][] vl_hog​(float[][][] image,
                                  int cellSize,
                                  boolean bilinearOrientations,
                                  HistogramOfOrientedGradients.VlHogVariant variant,
                                  int numOrientations,
                                  boolean directedPolarField,
                                  boolean undirectedPolarField)
      • vl_demo_hog

        public void vl_demo_hog()
      • runAlgorithm

        public void runAlgorithm()
        Description copied from class: AlgorithmBase
        Actually runs the algorithm. Implemented by inheriting algorithms.
        Specified by:
        runAlgorithm in class AlgorithmBase