lbp¶
-
menpo.feature.
lbp
(pixels, radius=None, samples=None, mapping_type='riu2', window_step_vertical=1, window_step_horizontal=1, window_step_unit='pixels', padding=True, verbose=False, skip_checks=False)[source]¶ Extracts Local Binary Pattern (LBP) features from the input image. The output image has
N * C
number of channels, whereN
is the number of channels of the original image andC
is the number of radius/samples values combinations that are used in the LBP computation.- Parameters
pixels (
Image
or subclass or(C, X, Y, ..., Z)
ndarray) – Either the image object itself or an array with the pixels. The first dimension is interpreted as channels. This means an N-dimensional image is represented by an N+1 dimensional array.radius (int or list of int or
None
, optional) – It defines the radius of the circle (or circles) at which the sampling points will be extracted. The radius (or radii) values must be greater than zero. There must be a radius value for each samples value, thus they both need to have the same length. IfNone
, then[1, 2, 3, 4]
is used.samples (int or list of int or
None
, optional) – It defines the number of sampling points that will be extracted at each circle. The samples value (or values) must be greater than zero. There must be a samples value for each radius value, thus they both need to have the same length. IfNone
, then[8, 8, 8, 8]
is used.mapping_type ({
u2
,ri
,riu2
,none
}, optional) – It defines the mapping type of the LBP codes. Selectu2
for uniform-2 mapping,ri
for rotation-invariant mapping,riu2
for uniform-2 and rotation-invariant mapping andnone
to use no mapping and only the decimal values instead.window_step_vertical (float, optional) – Defines the vertical step by which the window is moved, thus it controls the features density. The metric unit is defined by window_step_unit.
window_step_horizontal (float, optional) – Defines the horizontal step by which the window is moved, thus it controls the features density. The metric unit is defined by window_step_unit.
window_step_unit ({
pixels
,window
}, optional) – Defines the metric unit of the window_step_vertical and window_step_horizontal parameters.padding (bool, optional) – If
True
, the output image is padded with zeros to match the input image’s size.verbose (bool, optional) – Flag to print LBP related information.
skip_checks (bool, optional) – If
True
, do not perform any validation of the parameters.
- Returns
lbp (
Image
or subclass or(X, Y, ..., Z, C)
ndarray) – The ES features image. It has the same type and shape as the inputpixels
. The output number of channels isC = len(radius) * len(samples)
.- Raises
ValueError – Radius and samples must both be either integers or lists
ValueError – Radius and samples must have the same length
ValueError – Radius must be > 0
ValueError – Radii must be > 0
ValueError – Samples must be > 0
ValueError – Mapping type must be u2, ri, riu2 or none
ValueError – Horizontal window step must be > 0
ValueError – Vertical window step must be > 0
ValueError – Window step unit must be either pixels or window
References
- 1
T. Ojala, M. Pietikainen, and T. Maenpaa, “Multiresolution gray-scale and rotation invariant texture classification with local binary patterns”, IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 24, num. 7, p. 971-987, 2002.