Sai Rajesh Vanimireddy
Posted on December 31, 2019
1D Image:
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[69]: 5
}
2D Image:
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[67]: 2
3D Image:
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([[[1], [2]], [[3], [4]]])
c
c.shape
Out[70]: (2, 2, 1)
Posted on December 31, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.