One-dimensional pictures are those containing only one dimension. This is only possible when you're dealing with a line, as the only dimension you have is length, defined by a single array.When data objects are stored in an array, individual objects are selected by an index that is usually a non-negative scalar integer. Indexes are also called subscripts. An index maps the array value to a stored object. There are three ways in which the elements of an array can be indexed:
import numpy as np a = np.array([1, 2, 3,4,5]) a a.ndim a.shape len(a) Out: 5 }
The two dimensions depicted are length and width and the objects on the picture are flat. one of the examples of 2D images are gray scale images, a kind of black-and-white or gray monochrome.
import numpy as np b = np.array([[0, 1, 2], [3, 4, 5]]) b b.ndim b.shape len(b) Out: 2
Three-dimensional pictures contain yet another dimension can be a color image. Information in 3-D coordinates can also be objects that have less than three spatial dimensions and in which the third coordinate describes another property, such as time, color or a color channel.
import numpy as np c = np.array([[, ], [, ]]) c c.shape Out: (2, 2, 1)