Image Processing with NumPy (1)

NumPy’s array class is called ndarray. The more important attributes of an ndarray object are:

  • ndarray.ndim: the number of axes (dimensions) of the array.
  • ndarray.shape: the dimensions of the array. This is a tuple of integers indicating the size of the array in each dimension. For a matrix with n rows and m columns, shape will be (n,m). The length of the shape tuple is therefore the number of axes, ndim.
  • ndarray.size: the total number of elements of the array. This is equal to the product of the elements of shape.
  • ndarray.dtype: an object describing the type of the elements in the array.

Posted on July 14, 2021 Tags: