资源简介
局部线性二值模式是局部二值模式的升级,通过垂直方向和水平方向的像素点与中心像素点比较得到一副由二进制数组成的图像。其识别效果优于LBp,用MATLAB代码编写!
代码片段和文件信息
%LBP returns the local binary pattern image or LBP histogram of an image.
% J = LBP(IRNMAPPINGMODE) returns either a local binary pattern
% coded image or the local binary pattern histogram of an intensity
% image I. The LBP codes are computed using N sampling points on a
% circle of radius R and using mapping table defined by MAPPING.
% See the getmapping function for different mappings and use 0 for
% no mapping. Possible values for MODE are
% ‘h‘ or ‘hist‘ to get a histogram of LBP codes
% ‘nh‘ to get a normalized histogram
% Otherwise an LBP code image is returned.
%
% J = LBP(I) returns the original (basic) LBP histogram of image I
%
% J = LBP(ISPMAPPINGMODE) computes the LBP codes using n sampling
% points defined in (n * 2) matrix SP. The sampling points should be
% defined around the origin (coordinates (00)).
%
% Examples
% --------
% I=imread(‘rice.png‘);
% mapping=getmapping(8‘u2‘);
% H1=LBP(I18mapping‘h‘); %LBP histogram in (81) neighborhood
% %using uniform patterns
% subplot(211)stem(H1);
%
% H2=LBP(I);
% subplot(212)stem(H2);
%
% SP=[-1 -1; -1 0; -1 1; 0 -1; -0 1; 1 -1; 1 0; 1 1];
% I2=LBP(ISP0‘i‘); %LBP code image using sampling points in SP
% %and no mapping. Now H2 is equal to histogram
% %of I2.
function result = fenkuailbp(varargin) % imageradiusneighborsmappingmode)
% Version 0.3.2
% Authors: Marko Heikkil?and Timo Ahonen
% Changelog
% Version 0.3.2: A bug fix to enable using mappings together with a
% predefined spoints array
% Version 0.3.1: Changed MAPPING input to be a struct containing the mapping
% table and the number of bins to make the function run faster with high number
% of sampling points. Lauge Sorensen is acknowledged for spotting this problem.
% Check number of input arguments.
numBlk=0; %图形分块
% error(nargchk(15nargin));
error(nargchk(16nargin));
image=varargin{1};
d_image=double(image);
if nargin==1
spoints=[-1 -1; -1 0; -1 1; 0 -1; -0 1; 1 -1; 1 0; 1 1];
neighbors=8;
mapping=0;
mode=‘h‘;
end
if (nargin == 2) && (length(varargin{2}) == 1)
error(‘Input arguments‘);
end
if (nargin > 2) && (length(varargin{2}) == 1)
radius=varargin{2};
neighbors=varargin{3};
spoints=zeros(neighbors2);
% Angle step.
a = 2*pi/neighbors;
for i = 1:neighbors
spoints(i1) = -radius*sin((i-1)*a);
spoints(i2) = radius*cos((i-1)*a);
end
if(nargin >= 4)
mapping=varargin{4};
if(isstruct(mapping) && mapping.samples ~= neighbors)
error(‘Incompatible mapping‘);
end
else
mapping=0;
end
if(nargin >= 5)
mode=varargin{5};
else
mode=‘h‘;
end
%%%%%%
if (nargin>=6)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7072610 2016-01-21 11:56 LLBP\allfeature.mat
文件 7072610 2016-01-21 11:56 LLBP\allname.mat
文件 7694 2015-11-20 15:59 LLBP\fenkuailbp.m
文件 788 2015-10-20 16:27 LLBP\fenkuaizhifang.m
文件 9100 2016-01-20 11:15 LLBP\llbp.asv
文件 9520 2016-01-21 11:51 LLBP\llbp.m
文件 2598 2015-11-02 16:56 LLBP\llbpmapping.asv
文件 2599 2015-11-02 16:57 LLBP\llbpmapping.m
文件 2012 2016-01-21 10:28 LLBP\main.asv
文件 1976 2016-01-21 12:22 LLBP\main.m
文件 589 2016-01-20 11:23 LLBP\rocp.m
文件 432 2015-08-31 15:14 LLBP\segimg.m
文件 482 2016-01-20 11:22 LLBP\shbielvllbp.m
文件 527 2016-01-20 11:22 LLBP\swsb_llbp.m
目录 0 2016-01-20 11:23 LLBP
----------- --------- ---------- ----- ----
14183537 15
评论
共有 条评论