Given a precomputed summed-area table T, the sum of texture intensities over an arbitrary axis-aligned rectangular region bounded by horizontal coordinates [xl,xr] and vertical coordinates [yb,yt] (with xl≤xr and yb≤yt) is calculated in O(1) time using four table lookups via the principle of inclusion-exclusion:
Sum(xl,xr,yb,yt)=T[xr,yt]−T[xr,yb]−T[xl,yt]+T[xl,yb]
where T[x,y] denotes the summed-area table entry at coordinate (x,y).
The average texture intensity Iˉ over this rectangular region is obtained by dividing the sum by the region's continuous area:
Iˉ=AreaSum(xl,xr,yb,yt)=(xr−xl)(yt−yb)T[xr,yt]−T[xr,yb]−T[xl,yt]+T[xl,yb]
where (xr−xl)(yt−yb) is the total area of the sampled rectangular box-filter footprint in texture coordinate space.