example
features
= extractLBPFeatures(
I
,
Name,Value
)
uses additional options specified by one or more
Name,Value
pair arguments.
Code Generation Support:
Supports code generation: Yes
Generates platform-dependent library: No
Supports MATLAB
®
Function block: Yes
Code Generation Support, Usage Notes, and Limitations
lbpBricks1 = extractLBPFeatures(brickWall,'Upright',false);
lbpBricks2 = extractLBPFeatures(rotatedBrickWall,'Upright',false);
lbpCarpet = extractLBPFeatures(carpet,'Upright',false);
figure
bar([brickVsBrick; brickVsCarpet]','grouped')
title('Squared Error of LBP Histograms')
xlabel('LBP Histogram Bins')
legend('Bricks vs Rotated Bricks','Bricks vs Carpet')
Input image, specified as an M-by-N 2-D grayscale image that is real, and non-sparse.
Data Types: logical
| single
| double
| int16
| uint8
| uint16
Name-Value Pair Arguments
Specify optional comma-separated pairs of Name,Value
arguments. Name
is the argument name and Value
is the corresponding value. Name
must appear inside single quotes (' '
). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN
.
Example: 'NumNeighbors'
,8
Algorithm Parameters
The LBP algorithm parameters control how local binary patterns are computed for each pixel in the input image.
Number of neighbors used to compute the LBP for each pixel in the input image, specified as the comma-separated pair consisting of 'NumNeighbors
' and a positive integer. The set of neighbors is selected from a circularly symmetric pattern around each pixel. Increase the number of neighbors to encode greater detail around each pixel. Typical values range from 4
to 24
.
Radius of circular pattern used to select neighbors for each pixel in the input image, specified as the comma-separated pair consisting of 'Radius
' and a positive integer. To capture detail over a larger spatial scale, increase the radius. Typical values range from 1
to 5
.
Interpolation method used to compute pixel neighbors, specified as the comma-separated pair consisting of 'Interpolation
' and the string 'Linear'
or 'Nearest'
. Use 'Nearest'
for faster computation, but with less accuracy.
Histogram Parameters
The histogram parameters determine how the distribution of binary patterns is aggregated over the image to produce the output features.
Cell size, specified as the comma-separated pair consisting of 'CellSize
' and a 2-element vector. The number of cells is calculated as floor
(size
(I
)/CellSize
.
LBP feature vector, returned as a 1-by-N vector of length N representing the number of features. LBP features encode local texture information, which you can use for tasks such as classification, detection, and recognition. The function partitions the input image into non-overlapping cells. To collect information over larger regions, select larger cell sizes . However, when you increase the cell size, you lose local detail. N, depends on the number of cells in the image, numCells, the number of neighbors, P, and the Upright
parameter.
The number of cells is calculated as:
The figure shows an image with nine cell histograms. Each histogram describes an LBP feature.
The size of the histogram in each cell is [1,B], where B is the number of bins in the histogram. The number of bins depends on the Upright
property and the number of neighbors, P.
Upright | Number of Bins |
---|
true | numCells x (P x P–1) + 3) |
false | numCells x (P + 2) |
The overall LBP feature length, N, depends on the number of cells and the number of bins, B:
See Also
detectBRISKFeatures
| detectFASTFeatures
| detectHarrisFeatures
| detectMinEigenFeatures
|detectMSERFeatures
| detectSURFFeatures
| extractFeatures
| extractHOGFeatures
| matchFeatures
|MSERRegions
| SURFPoints
Introduced in R2015b
extractLBPFeaturesExtract local binary pattern (LBP) featurescollapse all in pageSyntaxfeatures = extractLBPFeatures(I)features = extractLBPFeatures(I,Name,Value)
matlab自带函数可以很好地提取hog特征,但是不好进行改进,因此在网上找了人家用maltab实现的hog特征提取,代码主要来自
http://www.cse.oulu.fi/wsgi/MVG/Downloads/
LBPMatlab
针对
lbp特征提取部分,有稍微进行修改,代码如下:
testmy
lbp.m
%
lbp的参数是以下,直接在这改,就不用在函数里一个一个的改动了
lbpcellsize=48;
mapping=getmapping(8,'u2');%以统一模式
lbp去映射
radius=1;
lbpF1 = extractLBPFeatures(f1,'Upright',false); %default
lbpF2 = extractLBPFeatures(f2,'Upright',false);
lbpF3 = extractLBPFeatures(f3,'Upright',false);
matlab中extractFeatures函数的用法公式描述输入参数输出参数
[features,validPoints] = extractFeatures(I,points)
[features,validPoints] = extractFeatures(I,points,Name,Value)
[features,validPoints] = extractFeatures(...
参考地址https://www.mathworks.com/matlabcentral/answers/386196-trying-to-display-a-lbp-image-from-extractlbpfeatures
记录一下,以防网址打不开…
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imto
参考文献:《Rotation Invariant Texture Classification using feature distributions》
《Multiresolution gray scale and rotation ivariant texture classification with local binary patterns》
matlab中的源码:
functi...
新手上路,有疑问或者错误欢迎留言指正
人脸数据集:ORL人脸数据集,该数据集共包含40个不同人的人脸图像,每个人有10张图像,一共400张图像,是在1992年4月至1994年4月期间由英国剑桥的Olivetti研究实验室创建。所有的图像是以PGM格式存储,灰度图,图像大小宽度为92,高度为112。每张图像是在不同的时间、不同的光照、不同的面部表情(睁眼/闭眼,微笑/不微笑)和面部细节(戴眼镜/不戴眼镜)环境下采集的。
构建训练数据集和测试数据集,训练数据集用来训练分类模型,测试数据集用来评估分
New Matlab implementation
A general Local Binary Pattern (LBP) implementation for Matlab:
lbp.m (2009-01-14,
ver 0.3.2)
getmapping.m (2008-06-13,
ver 0.1.1)
cont.m MATLAB
implementation of