Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Summed Area Table / Integral Image

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115413] Re: Summed Area Table / Integral Image
  • From: Peter Pein <petsie at dordos.net>
  • Date: Mon, 10 Jan 2011 02:39:44 -0500 (EST)
  • References: <igbng6$hfs$1@smc.vnet.net>

On 09.01.2011 08:18, Gareth Edwards wrote:
> Next newbie question....
>
> Suppose I have a 2D matrix, what would be a neat syntax for computed the
> 'Integral Image' or summed area table? (
> http://en.wikipedia.org/wiki/Summed_area_table )
>
> Many thanks in advance for any neat suggestions.
>
> Best,
>
> Gareth
>


Hi Gareth,

  if I understand the article correctly,

In[1]:= sat[m_]:=Map[Accumulate,m,{0,1}]

should do what you want

In[2]:= TableForm@sat@ConstantArray[1,{5,3}]
Out[2]//TableForm=
1	2	3
2	4	6
3	6	9
4	8	12
5	10	15


Cheers,

  Peter


  • Prev by Date: Re: original meaning of System` functions
  • Next by Date: ParsedBoxWrapper's in packages
  • Previous by thread: Summed Area Table / Integral Image
  • Next by thread: Re: Summed Area Table / Integral Image