User`s guide

4 Conversions
IntensitytoBinaryConversion
Binary images contain Boolean pixel values that are either 0 or 1. Pixels
with the value 0 are displayed as black; pixels with the value 1 are displayed
as white. Intensity images contain pixel values that range between the
minimum and maximum values supported by their data type. Intensity
images can contain only 0s and 1s, but they are not binary images unless
their data type is Boolean.
This section includes the following topics:
“Thresholding Intensity Images Using Relational Operators” on page 4-2
-- Use the Relational Operator block to convert an intensity image to a
binary image
“Thresholding Intensity Images Using the Autothreshold Block” on page
4-7 -- Use the Autothreshold block to convert an intensity image to a binary
image
Thresholding Intensity Images Using Relational
Operators
You can use the Relational Operator block to perform a thresholding operation
that converts your intensity image to a bina r y i m age. This examp le shows
you how to a ccomplish this task:
1 Define an intensity image in the MATLAB workspace. To read in an
intensity image from a PNG file, at the M ATLAB command prom pt, type
I= imread('rice.png');
I is a 256-by-256 matrix of 8-bit unsigned integer values that range from 0
to 255.
2 To view the image this matrix represents, at the MATLAB command
prompt, type
imshow(I)
4-2