From: Naved Nouyed on
Hi,

I am trying to vectorize the following function used for getting a LGBP of an image, is it possible to improve this code in any ways? Thanks .

function lgbp = LGBP(EO, nscale, norient)

[rows cols] = size(EO{1,1});

lgbp = cell(nscale,norient);

for v = 1:nscale
for mu = 1:norient
lgbp{v,mu} = zeros(rows,cols);
end
end

for v = 1:nscale
for mu = 1:norient
padEOcell = padarray(EO{v,mu},[1 1]);
for i = 2:rows+1
for j = 2:cols+1
lgbp{v,mu}(i-1,j-1) = S(padEOcell(i-1,j-1) - padEOcell(i,j)) * 2^0 +...
S(padEOcell(i-1,j) - padEOcell(i,j)) * 2^1 +...
S(padEOcell(i-1,j+1) - padEOcell(i,j)) * 2^2 +...
S(padEOcell(i, j+1) - padEOcell(i,j)) * 2^3 +...
S(padEOcell(i+1,j+1) - padEOcell(i,j)) * 2^4 +...
S(padEOcell(i+1,j) - padEOcell(i,j)) * 2^5 +...
S(padEOcell(i+1,j-1) - padEOcell(i,j)) * 2^6 +...
S(padEOcell(i, j-1) - padEOcell(i,j)) * 2^7;
end
end
end
end

end

function s = S(A)

if A >= 0
s = 1;
else
s = 0;
end

end
From: Oleg Komarov on
"Naved Nouyed" <iqbalnaved(a)gmail.com> wrote in message <hu1dsm$sch$1(a)fred.mathworks.com>...
> Hi,
>
> I am trying to vectorize the following function used for getting a LGBP of an image, is it possible to improve this code in any ways? Thanks .
>
> function lgbp = LGBP(EO, nscale, norient)

Input example please:
EO = ?
nscale = ?
norient = ?

Thanks

Oleg
From: Naved Nouyed on
Hi Oleg,

Thanks for replying. The inputs are as follows

EO = is a cell array containing the 40 gabor filtered images (5 scalex8 orientations)
so e.g.
if the original image is of size 128x128 then EO{1,1} will contain a gabor filtered image of scale 1 and orientation 1 of size 128x128

nscale = 5 % 5 scales
norient = 8 % orientations



"Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <hu2e57$nmd$1(a)fred.mathworks.com>...
> "Naved Nouyed" <iqbalnaved(a)gmail.com> wrote in message <hu1dsm$sch$1(a)fred.mathworks.com>...
> > Hi,
> >
> > I am trying to vectorize the following function used for getting a LGBP of an image, is it possible to improve this code in any ways? Thanks .
> >
> > function lgbp = LGBP(EO, nscale, norient)
>
> Input example please:
> EO = ?
> nscale = ?
> norient = ?
>
> Thanks
>
> Oleg