how can I calculate the LBP code for every pixel of 10*10 matrix except pixels in border and save the result in a new 10*10 matrix,the following codes are just for one pixel
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Batool Engineer
el 12 de Oct. de 2015
Respondida: Walter Roberson
el 12 de Oct. de 2015
% This example computes the LBP transformation of the pixel (2,2) input image A
clear all;
close all;
clc;
A = [ 5 4 3; 4 3 1; 2 0 3]; %build a an 3X3 image with center pixel 3
[N M]=size(A); % N=number of rows, M=number of columns
T=A(N-1,M-1); %Threshold value T is the gray level of middle element in 3X3
for i=1:N;
for j=1:M
B(i,j)=A(i,j)>= T;% B=1 if B>=A, otherwise B=0
end
end
n=[0 1 2;7 -inf 3;6 5 4] % -inf : minus infinity 2^(-inf)=0
w = 2.^n %Define weight matrix as 2^n, n= 0,1,2,...,7
B
C=w.*B %times Element-wise multiplication
LBPdec=sum(sum(C)),% LBP code in decimal
LBPbin=de2bi(LBPdec,'left-msb'), % LBP code in binary
0 comentarios
Respuesta aceptada
Walter Roberson
el 12 de Oct. de 2015
Pass the 10 x 10 matrix in to http://www.mathworks.com/matlabcentral/fileexchange/36484-local-binary-patterns
0 comentarios
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!