For Use with MATLAB
®
User’s Guide
Version 5
Image Processing Toolbox
How to Contact The MathWorks:
www.mathworks.com Web
comp.soft-sys.matlab Newsgroup
support@mathworks.com Technical support
suggest@mathworks.com Product enhancement suggestions
bugs@mathworks.com Bug reports
doc@mathworks.com Documentation error reports
service@mathworks.com Order status, license renewals, passcodes
info@mathworks.com Sales, pricing, and general information
508-647-7000 Phone
508-647-7001 Fax
The MathWorks, Inc. Mail
3 Apple Hill Drive
Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site.
Image Processing Toolbox User’s Guide
© COPYRIGHT 1993 - 2005 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or repro-
duced in any form without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by,
for, or through the federal government of the United States. By accepting delivery of the Program or
Documentation, the government hereby agrees that this software or documentation qualifies as commercial
computer software or commercial computer software documentation as such terms are used or defined in
FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this
Agreement and only those rights specified in this Agreement, shall pertain to and govern the use,
modification, reproduction, release, performance, display, and disclosure of the Program and Documentation
by the federal government (or other entity acquiring for or through the federal government) and shall
supersede any conflicting contractual terms or conditions. If this License fails to meet the government's
needs or is inconsistent in any respect with federal procurement law, the government agrees to return the
Program and Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, and xPC TargetBox are
registered trademarks of The MathWorks, Inc. Other product or brand names are trademarks
or registered trademarks of their respective holders.
Patents
The MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Revision History
August 1993 First printing Version 1
May 1997 Second printing Version 2
April 2001 Third printing Revised for Version 3.0
June 2001 Online only Revised for Version 3.1 (Release 12.1)
July 2002 Online only Revised for Version 3.2 (Release 13)
May 2003 Fourth printing Revised for Version 4.0 (Release 13.0.1)
September 2003 Online only Revised for Version 4.1 (Release 13SP1)
June 2004 Online only Revised for Version 4.2 (Release 14)
August 2004 Online only Revised for Version 5.0 (Release 14+)
October 2004 Fifth printing Revised for Version 5.0.1 (Release 14SP1)
March 2005 Online only Revised for Version 5.0.2 (Release 14SP2)
September 2005 Online only Revised for Version 5.1 (Release 14SP3)
i
Contents
1
Getting Started
What Is the Image Processing Toolbox? . . . . . . . . . . . . . . . . . 1-2
Configuration Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Related Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Compilability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Example 1 — Some Basic Concepts . . . . . . . . . . . . . . . . . . . . . 1-4
1. Read and Display an Image . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
2. Check How the Image Appears in the Workspace . . . . . . . . . 1-5
3. Improve Image Contrast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
4. Write the Image to a Disk File . . . . . . . . . . . . . . . . . . . . . . . . 1-8
5. Check the Contents of the Newly Written File . . . . . . . . . . . 1-9
Example 2 — Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . 1-11
1. Read and Display an Image . . . . . . . . . . . . . . . . . . . . . . . . . 1-11
2. Estimate the Value of Background Pixels . . . . . . . . . . . . . . 1-12
3. View the Background Approximation as a Surface . . . . . . . 1-13
4. Create an Image with a Uniform Background . . . . . . . . . . . 1-14
5. Adjust the Contrast in the Processed Image . . . . . . . . . . . . 1-15
6. Create a Binary Version of the Image . . . . . . . . . . . . . . . . . 1-16
7. Determine the Number of Objects in the Image . . . . . . . . . 1-18
8. Examine the Label Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . 1-18
9. Display the Label Matrix as a Pseudocolor Indexed Image 1-20
10. Measure Object Properties in the Image . . . . . . . . . . . . . . 1-20
11. Compute Statistical Properties of Objects in the Image . . 1-22
Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24
Online Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24
Image Processing Demos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24
MATLAB Newsgroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-25
Image Credits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-26
评论0