Skip to content
/ hog Public

Histogram of oriented gradients feature descriptor

License

Notifications You must be signed in to change notification settings

image-js/hog

Repository files navigation

HOG features (Histogram of oriented gradients)

build status npm download

Principe

The main feature of this repository will compute the HOG features of an image. The HOG features (called HOG descriptor too) are useful for image recognition and image detection. You can find a good tutorial about HOG features here.

Installation

npm install hog-features -S

Usage

extractHOG(image[, options])

Generate a vector which corresponds to the HOG descriptor of an image. Returns an array of float.

arguments

  • image - an Image
  • options - an optional object

options

  • cellSize: length of cell in px (default: 4).
  • blockSize: length of block in number of cells (default: 2).
  • blockStride: number of cells to slide block window by (default: block-size / 2).
  • bins: bins per histogram (default: 6).
  • norm: norm block normalization method (default: "L2". Other possibilities : "L1" and "L1-sqrt").

Example

'use strict';

const {Image} = require('image-js');
const hog = require('hog-features');

const file = __dirname + '/__test__/beachball.png';

Image.load(file).then(function (image) {
    var descriptor = hog.extractHOG(image);
    console.log(descriptor);
});

Tutorial

You can find a tutorial where the HOG features is used with an SVM classifier to classify road signs. Here is the tutorial.

License

MIT

Inspired by harthur implementation

About

Histogram of oriented gradients feature descriptor

Resources

License

Stars

Watchers

Forks

Packages

No packages published