From: Naved Nouyed on
Hi,

I've been using the following code to acquire local histogram of an image, but I've found it to be quite slow, for example, for a 128x128 grayscale image it takes about 25 seconds to acquire all the histograms. Could you please provide any tips on how to reduce this time? The code is given below. Thank you.

Hlocal = cell(nscale,norient,nbin);
for v = 1:nscale
for mu = 1:norient
for r = 1:nregion
Hlocal{v,mu,r} = zeros(1,nbin);
end
end
end
tic
for v = 1:nscale
for mu = 1:norient
for r = 1:nregion
for i = 1:nbin
for x = 1:rrows
for y=1:rcols
Hlocal{v,mu,r}(i) = Hlocal{v,mu,r}(i) + delta(lgbp_r{v,mu,r}(x,y) - i);
end
end
end
end
end
end
From: Bruno Luong on
Please take a look of a similar topic here:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/263453#688405

Bruno
From: ImageAnalyst on
Did you try imhist()? Or even hist() or histc()?
From: Naved Nouyed on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <9484af86-701a-43c4-a5fc-1a9c594a7cff(a)a20g2000vbc.googlegroups.com>...
> Did you try imhist()? Or even hist() or histc()?

Thanks for replying. I didn't use the built in functions because I am not sure the equation for local histogram that I am trying to implement can be done with them, here's the eq

Hv,mu,r(i) = Sum( del (LGBPv,mu(x,y) - i) , i = 0,1,..., L-1

Where, del(z) = 1, if z = 0 or 0, otherwise
and L = bin number of the histogram

Thank you.
From: Naved Nouyed on
"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hu05aj$cig$1(a)fred.mathworks.com>...
> Please take a look of a similar topic here:
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/263453#688405
>
> Bruno

You told there to,
"Bin the whole image

[C imbin] = histc(im,map_img)

then use ACCUMARRAY on imbin instead of IMHIST"

is it this doable, if I perform LBP on the image then get the histogram of the total image and then separate the local histograms?