image_fhog: HOG (Histogram Of Gradients) feature extraction

Description Usage Arguments Value References Examples

View source: R/image_fhog.R

Description

Gets the histogram of oriented gradients (HOG) feature descriptor https://en.wikipedia.org/wiki/Histogram_of_oriented_gradients of an image. More information on the calculation, see the reference paper or the dlib reference http://dlib.net/dlib/image_transforms/fhog_abstract.h.html

Usage

1
2
3
4
5
6
image_fhog(
  x,
  cell_size = 8L,
  filter_rows_padding = 1L,
  filter_cols_padding = 1L
)

Arguments

x

a 3-dimensional array of integer pixel values where the first dimension is RGB, 2nd the width of the image and the 3rd the height of the image. See the example.

cell_size

integer. HOG groups pixels in cells, based on which a histogram of the gradiens is computed. Give the cell size. Defaults to 8.

filter_rows_padding

integer indicating how many extra rows and columns of zero padding along the borders to add, for more efficient convolution code

filter_cols_padding

integer indicating how many extra rows and columns of zero padding along the borders to add, for more efficient convolution code

Value

a list with HOG features of the pixels mapped into HOG space. It contains:

References

Object Detection with Discriminatively Trained Part Based Models by P. Felzenszwalb, R. Girshick, D. McAllester, D. Ramanan IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 32, No. 9, Sep. 2010

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(magick)
f <- system.file("extdata", "cruise_boat.png", package = "image.dlib")
x <- image_read(f)
x
feats <- image_data(x, channels = "rgb")
feats <- as.integer(feats, transpose = FALSE)
feats <- image_fhog(feats, cell_size = 8)
str(feats)

## FHOG feature vector of pixel at HOG space position 1, 1
feats$fhog[1, 1, ]
## FHOG feature vector of pixel at HOG space position 4 (height), 7 (width)
feats$fhog[4, 7, ]

image.dlib documentation built on July 27, 2020, 5:07 p.m.