def integral_image(img):
 S = img
 for i in range(img.ndim):
  S = S.cumsum(axis=i)
 return S

def integral_image ( img ) : S = img for i in range ( img . ndim ) : S = S . cumsum ( axis = i ) return S
integral image / summed area table .