
48 A Computational Introduction to Digital Image Processing, Second Edition
(a) The caribou image turned binary (b) After conversion to type uint8
FIGURE 3.3: Making the image binary
MATLAB/Octave
clu 256x256 65536 uint8
If we now try to display this matrix with imshow, we obtain the result shown in Fig-
ure 3.3(b). A very disappointing image! But this is to be expected; in a matrix of type
uint8, white is 255, 0 is black, and 1 is a very dark gray which is indistinguishable from
black.
To get back to a viewable image, we can either turn the logical flag back on, and the
view the result:
MATLAB/Octave
>> imshow(logical(clu))
or simply convert to type double ...