Image.sum#
- Image.sum(**kwargs: Any) generic | ndarray[source]#
Sum of all pixels
- Parameters:
kwargs (dict) – additional keyword arguments passed to
numpy.nansum- Returns:
sum
Computes the sum of pixels in the image:
\[\sum_{uvc} I_{uvc}\]Example:
>>> from machinevisiontoolbox import Image >>> img = Image.Read('flowers1.png') >>> img.sum() # sum over all planes np.uint64(86260474) >>> img.sum(axis=(0,1)) # per-plane sum array([28267315, 30542247, 27450912], dtype=uint64)
Note
The return value type is the same as the image type.
NaN values are ignored in the sum
For
axisremember the axes are in NumPy order: 0=rows, 1=columns, 2=planes.