User`s guide
7 Analysis and Enhancement
Feature Extraction
Feature extraction techniques return information about the structure of an
image. For example, you can use them to find edges, locations, and attributes
of objects.
This section includes the following topics:
• “Finding Edges in Im ages” on page 7-2 — Use the Edge Detection block to
find object boundaries
• “Finding Lines in Images” on page 7-9 — Use the Hough Transform, Find
Local Maxima, and Hough Lines blocks to find the longest line in an image
• “Measuring an Angle Between Lines” on page 7-17— U se the Hough
Transform, Hough Lines, and Draw Shapes block to draw tw o lines on an
image and measure the angle between them
Finding Edges in Images
YoucanusetheEdgeDetectionblocktofindtheedgesofobjectsinanimage.
This block finds the pixel locations where the magnitude of the gradient of
intensity is larger than a threshold value. These locations typically occur at
the boundaries of objects. In this section, you use the Edge De tection block to
find the edges of rice grains in an intensity image:
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 integers.
2 To view the image this matrix represents, at the MATLAB command
prompt, type
imshow(I)
7-2