To gain a better understanding of how MATLAB treats images, we have to revisit the way it stores them in the Workspace window. In the previous chapter, we discussed the origin of MATLAB and why it is an ideal choice for processing images. So, let's start with a simple quiz to freshen your memory.
Let's start using the matrix manipulation property of MATLAB to our advantage. We have already seen how to import an image into the Workspace window, using the imread
function:
>> img = imread('my_image.bmp');
Importing the image automatically generates a matrix variable in the Workspace window. Its dimensions (rows, columns, and colors) are the same as the original image and it also has the same depth (given in bits). In our example, the resulting matrix is 485 x 656
and its type is uint8
, it means that the matrix has 485 rows, 656 columns, and its values are unsigned integers
with a depth of 8
bits spanning from 0
(black) to 255
(white). The...