I want to calculate the integral image. eg
a=array([(1,2,3),(4,5,6)]) b = a.cumsum(axis=0)
This will generate another b.Can array. I execute cumsum in place. If not. Are there other methods for this,
cumsum
You must pass the argument out :
out
np.cumsum(a, axis=1, out=a)
OBS: your array is actually a 2-D array, so you can use axis=0 to sum over rows and axis=1 to sum over columns.
axis=0
axis=1
Try this with numpy directly numpy.cumsum(a) :
numpy.cumsum(a)
a=array([(1,2,3)]) b = np.cumsum(a) print b >>array([1,3,6])