integral image for each depth in a three dimensional array

Emmanuelle Gouillart emmanuelle.gouillart at nsup.org
Tue Aug 6 05:48:53 EDT 2013


On Tue, Aug 06, 2013 at 11:45:31AM +0200, Johannes Sch�nberger wrote:
> @Emmanuelle: didn't know about that, thanks for pointing that out!

> Johannes Sch�nberger

Didn't know either, but I had a look at the code:
return x.cumsum(1).cumsum(0)

so additional dimensions are "transparent"

Emma

> Am 06.08.2013 um 11:43 schrieb Emmanuelle Gouillart <emmanuelle.gouillart at nsup.org>:

> > Hi Masa,

> > actually you can pass a 3-D array to integral_image :

> >>>> from skimage import transform
> >>>> a = np.arange(27).reshape((3, 3, 3))
> >>>> a
> > array([[[ 0,  1,  2],
> >        [ 3,  4,  5],
> >        [ 6,  7,  8]],

> >       [[ 9, 10, 11],
> >        [12, 13, 14],
> >        [15, 16, 17]],

> >       [[18, 19, 20],
> >        [21, 22, 23],
> >        [24, 25, 26]]])
> >>>> transform.integral_image(a)
> > array([[[  0,   1,   2],
> >        [  3,   5,   7],
> >        [  9,  12,  15]],

> >       [[  9,  11,  13],
> >        [ 24,  28,  32],
> >        [ 45,  51,  57]],

> >       [[ 27,  30,  33],
> >        [ 63,  69,  75],
> >        [108, 117, 126]]])


> > Would this do the trick?
> > Cheers,
> > Emmanuelle

> > On Tue, Aug 06, 2013 at 02:36:32AM -0700, masa wrote:
> >> Hi all,

> >> I want to calculate integral images for each depth in a three dimensional
> >> array.
> >> My code is something like this:

> >> ret = np.empty(height, width, depth)
> >> int_imgs = [integral_image(image[:,:,i]) for i in range(depth)]
> >> for i in range(depth):
> >>      ret[:,:,i] = int_imgs[i]

> >> Is there better way to do this?

> >> Thanks,
> >> masa

> > -- 
> > You received this message because you are subscribed to the Google Groups "scikit-image" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe at googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.



More information about the scikit-image mailing list