不断的旋转圆形邻域内的LBP特征,根据选择得到一系列的LBP特征值,从这些LBP特征值选择LBP特征值最小的作为中心像素点的LBP特征。
matlab源码
function imglbp = getRotationInvariantLBPFeature(img, radius, neighbors)
imgSize = size(img);
if numel(imgSize) > 2
imgG = rgb2gray(img);
else
imgG = img;
end
[rows, cols] = size(imgG);
rows=int16(rows);
cols=int16(cols);
imglbp = uint8(zeros(rows-2*radius, cols-2*radius));
for k=0:neighbors-1
% 计算采样点对于中心点坐标的偏移量rx,ry
rx = radius * cos(2.0 * pi * k / neighbors);
ry = -radius * sin(2.0 * pi * k / neighbors);
% 对采样点偏移量分别进行上下取整
x1 = floor(rx);
x2 = ceil(rx);
y1 = floor(ry);
y2 = ceil(ry);
% 将坐标偏移量映射到0-1之间
tx =