From: Julia Weidner on
Walter Roberson <roberson(a)hushmail.com> wrote in message <i2q0nv$rqb$1(a)canopus.cc.umanitoba.ca>...
> ImageAnalyst wrote:
> > Like Walter said, histogramming can get tricky if it's not uint8. (I
> > have demos for other data types if needed.)
> >
> > What you might try is to save the histograms of each block, and add
> > them into the "cumulative" histograms, which you're building up for
> > the entire image, using the "persistent" or "global" keywords, or
> > getappdata() and setappdata().
>
> Perhaps,
>
> %MaxValue would be 1 or intmax(class(TheImageName))
> RGBSelect = 1;
> binedges = linspace(0,MaxValue,NumBins);
>
> T = blockproc(TheImageName, [10 10],
> @(v)histc(reshape(v.data(:,:,RGBSelect),1,[]),binedges) );
>
> thehistogram = sum( reshape(T .', NumBins, []), 2 ) .';
>
>
> Except that I would use a block size bigger than 10 x 10 for efficiency.
>
> Oh, and be warned that if the original image could not be duplicated because
> doing so would overflow memory, then the above will almost certainly overfill
> memory... unless, that is, you use a block size that has more pixels than the
> number of bins you are accumulating into.
>
>
> You want efficiency, you don't use blockproc ;-)

The images I am trying to histogram are uint8. I have tried using global variables but with no avail.

I understand the suggestions on code above but I am curious to your suggestions about how you would go about doing large image processing WITHOUT using blockproc...