100% found this document useful (2 votes)
8 views55 pages

MATLAB Image Processing Toolbox User s Guide The Mathworks download

The document is a user's guide for the MATLAB Image Processing Toolbox, detailing its features, configuration notes, and basic image processing techniques. It includes links to additional MATLAB toolboxes and provides contact information for MathWorks. The guide covers various image types, operations, and includes a revision history dating back to 1993.

Uploaded by

fsstgpmh1445
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
8 views55 pages

MATLAB Image Processing Toolbox User s Guide The Mathworks download

The document is a user's guide for the MATLAB Image Processing Toolbox, detailing its features, configuration notes, and basic image processing techniques. It includes links to additional MATLAB toolboxes and provides contact information for MathWorks. The guide covers various image types, operations, and includes a revision history dating back to 1993.

Uploaded by

fsstgpmh1445
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

MATLAB Image Processing Toolbox User s Guide The

Mathworks download

https://textbookfull.com/product/matlab-image-processing-toolbox-
user-s-guide-the-mathworks/

Download full version ebook from https://textbookfull.com


We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!

MATLAB Signal Processing Toolbox User s Guide The


Mathworks

https://textbookfull.com/product/matlab-signal-processing-
toolbox-user-s-guide-the-mathworks/

MATLAB Econometrics Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-econometrics-toolbox-
user-s-guide-the-mathworks/

MATLAB Bioinformatics Toolbox User s Guide The


Mathworks

https://textbookfull.com/product/matlab-bioinformatics-toolbox-
user-s-guide-the-mathworks/

MATLAB Mapping Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-mapping-toolbox-user-s-
guide-the-mathworks/
MATLAB Optimization Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-optimization-toolbox-
user-s-guide-the-mathworks/

MATLAB Trading Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-trading-toolbox-user-s-
guide-the-mathworks/

MATLAB Computer Vision Toolbox User s Guide The


Mathworks

https://textbookfull.com/product/matlab-computer-vision-toolbox-
user-s-guide-the-mathworks/

MATLAB Curve Fitting Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-curve-fitting-toolbox-
user-s-guide-the-mathworks/

MATLAB Fuzzy Logic Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-fuzzy-logic-toolbox-user-
s-guide-the-mathworks/
Image Processing Toolbox™
User's Guide

R2020a
How to Contact MathWorks

Latest news: www.mathworks.com

Sales and services: www.mathworks.com/sales_and_services

User community: www.mathworks.com/matlabcentral

Technical support: www.mathworks.com/support/contact_us

Phone: 508-647-7000

The MathWorks, Inc.


1 Apple Hill Drive
Natick, MA 01760-2098
Image Processing Toolbox™User's Guide
© COPYRIGHT 1993–2020 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 reproduced 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 and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be
trademarks or registered trademarks of their respective holders.
Patents
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 13.SP1)
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)
March 2006 Online only Revised for Version 5.2 (Release 2006a)
September 2006 Online only Revised for Version 5.3 (Release 2006b)
March 2007 Online only Revised for Version 5.4 (Release 2007a)
September 2007 Online only Revised for Version 6.0 (Release 2007b)
March 2008 Online only Revised for Version 6.1 (Release 2008a)
October 2008 Online only Revised for Version 6.2 (Release 2008b)
March 2009 Online only Revised for Version 6.3 (Release 2009a)
September 2009 Online only Revised for Version 6.4 (Release 2009b)
March 2010 Online only Revised for Version 7.0 (Release 2010a)
September 2010 Online only Revised for Version 7.1 (Release 2010b)
April 2011 Online only Revised for Version 7.2 (Release 2011a)
September 2011 Online only Revised for Version 7.3 (Release 2011b)
March 2012 Online only Revised for Version 8.0 (Release 2012a)
September 2012 Online only Revised for Version 8.1 (Release 2012b)
March 2013 Online only Revised for Version 8.2 (Release 2013a)
September 2013 Online only Revised for Version 8.3 (Release 2013b)
March 2014 Online only Revised for Version 9.0 (Release 2014a)
October 2014 Online only Revised for Version 9.1 (Release 2014b)
March 2015 Online only Revised for Version 9.2 (Release 2015a)
September 2015 Online only Revised for Version 9.3 (Release 2015b)
March 2016 Online only Revised for Version 9.4 (Release 2016a)
September 2016 Online only Revised for Version 9.5 (Release 2016b)
March 2017 Online only Revised for Version 10.0 (Release 2017a)
September 2017 Online only Revised for Version 10.1 (Release 2017b)
March 2018 Online only Revised for Version 10.2 (Release 2018a)
September 2018 Online only Revised for Version 10.3 (Release 2018b)
March 2019 Online only Revised for Version 10.4 (Release 2019a)
September 2019 Online only Revised for Version 11.0 (Release 2019b)
March 2020 Online only Revised for Version 11.1 (Release 2020a)
Contents

Getting Started
1
Image Processing Toolbox Product Description . . . . . . . . . . . . . . . . . . . . . 1-2
Key Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2

Configuration Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3

Compilability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4

Basic Image Import, Processing, and Export . . . . . . . . . . . . . . . . . . . . . . . 1-5

Correct Nonuniform Illumination and Analyze Foreground Objects . . . . 1-10

Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-18


Product Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-18
Image Processing Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-18
MATLAB Newsgroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-18

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-19

Introduction
2
Images in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2

Image Coordinate Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3


Pixel Indices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
Spatial Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4

Define World Coordinates Using XData and YData Properties . . . . . . . . . 2-6


Display an Image using Nondefault Spatial Coordinates . . . . . . . . . . . . . . 2-6

Define World Coordinates Using Spatial Referencing . . . . . . . . . . . . . . . . 2-9

Image Types in the Toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11


Binary Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12
Indexed Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12
Grayscale Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
Truecolor Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14
HDR Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14
Multispectral and Hyperspectral Images . . . . . . . . . . . . . . . . . . . . . . . . . 2-15
Label Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16

v
Display Separated Color Channels of RGB Image . . . . . . . . . . . . . . . . . . . 2-17

Convert Between Image Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20

Convert Image Data Between Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-21


Overview of Image Class Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-21
Losing Information in Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-21
Converting Indexed Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-21

Perform an Operation on a Sequence of Images . . . . . . . . . . . . . . . . . . . 2-22

Detecting Cars in a Video of Traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-24

Process Folder of Images Using Image Batch Processor App . . . . . . . . . 2-30

Process Large Set of Images Using MapReduce Framework and Hadoop


......................................................... 2-38

Work with Image Sequences as Multidimensional Arrays . . . . . . . . . . . . 2-48


Create Multidimensional Array Representing Image Sequence . . . . . . . . 2-48
Display Image Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-48
Process Image Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-49

Image Arithmetic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-51

Image Arithmetic Clipping Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-52

Nest Calls to Image Arithmetic Functions . . . . . . . . . . . . . . . . . . . . . . . . 2-53

Find Vegetation in a Multispectral Image . . . . . . . . . . . . . . . . . . . . . . . . . 2-54

Reading and Writing Image Data


3
Get Information About Graphics Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2

Read Image Data into the Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3

Read Multiple Images from a Single Graphics File . . . . . . . . . . . . . . . . . . 3-5

Read and Write 1-Bit Binary Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6

Write Image Data to File in Graphics Format . . . . . . . . . . . . . . . . . . . . . . . 3-7

Determine Storage Class of Output Files . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8

DICOM Support in Image Processing Toolbox . . . . . . . . . . . . . . . . . . . . . . 3-9

Read Metadata from DICOM Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10


Private DICOM Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
Create Your Own Copy of DICOM Dictionary . . . . . . . . . . . . . . . . . . . . . . 3-11

vi Contents
Read Image Data from DICOM Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
View DICOM Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12

Write Image Data to DICOM Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13


Include Metadata with Image Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13

Explicit Versus Implicit VR Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14

Remove Confidential Information from a DICOM File . . . . . . . . . . . . . . . 3-15

Create New DICOM Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16

Mayo Analyze 7.5 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18

Interfile Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19

Work with High Dynamic Range Images . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20


Read HDR Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
Display and Process HDR Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
Create High Dynamic Range Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-21
Write High Dynamic Range Image to File . . . . . . . . . . . . . . . . . . . . . . . . 3-21

Display High Dynamic Range Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-22

Displaying and Exploring Images


4
Image Display and Exploration Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2

Display an Image in a Figure Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3


Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
Specifying the Initial Image Magnification . . . . . . . . . . . . . . . . . . . . . . . . 4-5
Controlling the Appearance of the Figure . . . . . . . . . . . . . . . . . . . . . . . . . 4-5

Display Multiple Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7


Display Multiple Images in Separate Figure Windows . . . . . . . . . . . . . . . . 4-7
Display Multiple Images in a Montage . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Display Images Individually in the Same Figure . . . . . . . . . . . . . . . . . . . . 4-9
Compare a Pair of Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10

View Thumbnails of Images in Folder or Datastore . . . . . . . . . . . . . . . . . 4-11

Interact with Images Using Image Viewer App . . . . . . . . . . . . . . . . . . . . . 4-17


Open Image Viewer App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18
Initial Image Magnification in Image Viewer App . . . . . . . . . . . . . . . . . . 4-19
Choose Colormap Used by Image Viewer App . . . . . . . . . . . . . . . . . . . . . 4-19
Import Image Data from Workspace into Image Viewer App . . . . . . . . . . 4-20
Export Image Data from Image Viewer App to Workspace . . . . . . . . . . . . 4-21
Save Image Data Displayed in Image Viewer . . . . . . . . . . . . . . . . . . . . . . 4-22
Close the Image Viewer App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-22
Print Images Displayed in Image Viewer App . . . . . . . . . . . . . . . . . . . . . 4-23

vii
Explore Images with Image Viewer App . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24
Explore Images Using the Overview Tool . . . . . . . . . . . . . . . . . . . . . . . . 4-24
Pan Images Displayed in Image Viewer App . . . . . . . . . . . . . . . . . . . . . . 4-25
Zoom Images in the Image Viewer App . . . . . . . . . . . . . . . . . . . . . . . . . . 4-26
Specify Image Magnification in Image Viewer . . . . . . . . . . . . . . . . . . . . . 4-26

Get Pixel Information in Image Viewer App . . . . . . . . . . . . . . . . . . . . . . . 4-28


Determine Individual Pixel Values in Image Viewer . . . . . . . . . . . . . . . . . 4-28
Determine Pixel Values in an Image Region . . . . . . . . . . . . . . . . . . . . . . 4-29
Determine Image Display Range in Image Viewer . . . . . . . . . . . . . . . . . . 4-32

Measure Distance Between Pixels in Image Viewer App . . . . . . . . . . . . . 4-34


Determine Distance Between Pixels Using Distance Tool . . . . . . . . . . . . . 4-34
Export Endpoint and Distance Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-35
Customize the Appearance of the Distance Tool . . . . . . . . . . . . . . . . . . . 4-36

Get Image Information in Image Viewer App . . . . . . . . . . . . . . . . . . . . . . 4-37

Adjust Image Contrast in Image Viewer App . . . . . . . . . . . . . . . . . . . . . . 4-39


Open the Adjust Contrast Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-39
Adjust Image Contrast Using the Histogram Window . . . . . . . . . . . . . . . 4-41
Adjust Image Contrast Using Window/Level Tool . . . . . . . . . . . . . . . . . . . 4-42
Make Contrast Adjustments Permanent . . . . . . . . . . . . . . . . . . . . . . . . . 4-44

Interactive Contrast Adjustment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-46

Crop Image Using Image Viewer App . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-47

Explore 3-D Volumetric Data with Volume Viewer App . . . . . . . . . . . . . . 4-50


Load Volume Data into the Volume Viewer . . . . . . . . . . . . . . . . . . . . . . . 4-50
View the Volume Data in the Volume Viewer . . . . . . . . . . . . . . . . . . . . . . 4-52
Adjust View of Volume Data in Volume Viewer . . . . . . . . . . . . . . . . . . . . . 4-55
Refine the View with the Rendering Editor . . . . . . . . . . . . . . . . . . . . . . . 4-57
Save Volume Viewer Rendering and Camera Configuration Settings . . . . 4-62

Explore 3-D Labeled Volumetric Data with Volume Viewer App . . . . . . . 4-63
Load Labeled Volume and Intensity Volume into Volume Viewer . . . . . . . 4-63
View Labeled Volume in Volume Viewer . . . . . . . . . . . . . . . . . . . . . . . . . 4-65
Embed Labeled Volume with Intensity Volume . . . . . . . . . . . . . . . . . . . . 4-66

View Image Sequences in Video Viewer App . . . . . . . . . . . . . . . . . . . . . . . 4-71


View MRI Sequence Using Video Viewer App . . . . . . . . . . . . . . . . . . . . . 4-71
Configure Video Viewer App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-74
Specifying the Frame Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-75
Specify Color Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-76
Get Information about an Image Sequence . . . . . . . . . . . . . . . . . . . . . . . 4-76

Convert Multiframe Image to Movie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-78

Display Different Image Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-79


Display Indexed Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-79
Display Grayscale Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-79
Display Binary Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-81
Display Truecolor Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-82

viii Contents
Add Color Bar to Displayed Grayscale Image . . . . . . . . . . . . . . . . . . . . . . 4-84

Print Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-86


Graphics Object Properties That Impact Printing . . . . . . . . . . . . . . . . . . 4-86

Manage Display Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-87


Retrieve Values of Toolbox Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . 4-87
Set Values of Toolbox Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-87

Building GUIs with Modular Tools


5
Build Custom Image Processing Apps Using Modular Interactive Tools
.......................................................... 5-2

Interactive Modular Tool Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7


Display Target Image in Figure Window . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8
Associate Modular Tools with Target Image . . . . . . . . . . . . . . . . . . . . . . . 5-8
Associate Modular Tools with Particular Target Image . . . . . . . . . . . . . . . 5-9
Get Handle to Target Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-10
Specify Parent of Modular Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12
Position Modular Tools in GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-14
Adding Navigation Aids to GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-15

Build App to Display Pixel Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-19

Build App for Navigating Large Images . . . . . . . . . . . . . . . . . . . . . . . . . . 5-21

Customize Modular Tool Interactivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-23

Build Image Comparison Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-24

Create Angle Measurement Tool Using ROI Objects . . . . . . . . . . . . . . . . 5-27

Geometric Transformations
6
Resize an Image with imresize Function . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2

Rotate an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6

Crop an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8

Translate an Image using imtranslate Function . . . . . . . . . . . . . . . . . . . . 6-10

2-D and 3-D Geometric Transformation Process Overview . . . . . . . . . . . 6-13


Create Geometric Transformation Object . . . . . . . . . . . . . . . . . . . . . . . . 6-13
Perform the Geometric Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16

ix
Matrix Representation of Geometric Transformations . . . . . . . . . . . . . . . 6-17
2-D Affine Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-17
2-D Projective Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-18
Create Composite 2-D Affine Transformations . . . . . . . . . . . . . . . . . . . . . 6-19
3-D Affine Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-21

Specify Fill Values in Geometric Transformation Output . . . . . . . . . . . . . 6-23

Perform Simple 2-D Translation Transformation . . . . . . . . . . . . . . . . . . . 6-25

N-Dimensional Spatial Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . 6-29

Register Two Images Using Spatial Referencing to Enhance Display . . . 6-31

Create a Gallery of Transformed Images . . . . . . . . . . . . . . . . . . . . . . . . . . 6-36

Exploring a Conformal Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-52

Exploring Slices from a 3-Dimensional MRI Data Set . . . . . . . . . . . . . . . 6-64

Padding and Shearing an Image Simultaneously . . . . . . . . . . . . . . . . . . . 6-71

Image Registration
7
Approaches to Registering Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Registration Estimator App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Intensity-Based Automatic Image Registration . . . . . . . . . . . . . . . . . . . . . 7-3
Control Point Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
Automated Feature Detection and Matching . . . . . . . . . . . . . . . . . . . . . . . 7-5

Register Images Using Registration Estimator App . . . . . . . . . . . . . . . . . . 7-6

Load Images, Spatial Referencing Information, and Initial


Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14
Load Images from File or Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14
Provide Spatial Referencing Information . . . . . . . . . . . . . . . . . . . . . . . . . 7-15
Provide an Initial Geometric Transformation . . . . . . . . . . . . . . . . . . . . . . 7-15

Tune Registration Settings in Registration Estimator App . . . . . . . . . . . 7-17


Geometric Transformations Supported by Registration Estimator App . . 7-17
Feature-Based Registration Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-17
Intensity-Based Registration Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18
Nonrigid and Post-Processing Settings . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18

Export Results from Registration Estimator App . . . . . . . . . . . . . . . . . . . 7-20


Export Results to the Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-20
Generate a Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-20

Techniques Supported by Registration Estimator App . . . . . . . . . . . . . . . 7-22


Feature-Based Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-22
Intensity-Based Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-22

x Contents
Nonrigid Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-23

Intensity-Based Automatic Image Registration . . . . . . . . . . . . . . . . . . . . 7-24

Create an Optimizer and Metric for Intensity-Based Image Registration


......................................................... 7-26

Use Phase Correlation as Preprocessing Step in Registration . . . . . . . . 7-27

Register Multimodal MRI Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-32

Register Multimodal 3-D Medical Images . . . . . . . . . . . . . . . . . . . . . . . . . 7-42

Registering an Image Using Normalized Cross-Correlation . . . . . . . . . . 7-50

Control Point Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-56

Geometric Transformation Types for Control Point Registration . . . . . . 7-58

Control Point Selection Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-60

Start the Control Point Selection Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-62

Find Visual Elements Common to Both Images . . . . . . . . . . . . . . . . . . . . 7-64


Use Scroll Bars to View Other Parts of an Image . . . . . . . . . . . . . . . . . . . 7-64
Use the Detail Rectangle to Change the View . . . . . . . . . . . . . . . . . . . . . 7-64
Pan the Image Displayed in the Detail Window . . . . . . . . . . . . . . . . . . . . 7-64
Zoom In and Out on an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-65
Specify the Magnification of the Images . . . . . . . . . . . . . . . . . . . . . . . . . 7-65
Lock the Relative Magnification of the Moving and Fixed Images . . . . . . 7-66

Select Matching Control Point Pairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-68


Pick Control Point Pairs Manually . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-68
Use Control Point Prediction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-69
Move Control Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-71
Delete Control Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-71

Export Control Points to the Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . 7-73

Find Image Rotation and Scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-75

Use Cross-Correlation to Improve Control Point Placement . . . . . . . . . . 7-79

Register Images with Projection Distortion Using Control Points . . . . . 7-80

Designing and Implementing Linear Filters for Image Data


8
What Is Image Filtering in the Spatial Domain? . . . . . . . . . . . . . . . . . . . . 8-2
Convolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Correlation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3

xi
Integral Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5

Filter Grayscale and Truecolor (RGB) Images using imfilter Function . . . 8-7

imfilter Boundary Padding Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-11

Filter Images Using Predefined Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-14

Generate HDL Code for Image Sharpening . . . . . . . . . . . . . . . . . . . . . . . . 8-17

What is Guided Image Filtering? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-24

Perform Flash/No-flash Denoising with Guided Filter . . . . . . . . . . . . . . . 8-25

Segment Thermographic Image after Edge-Preserving Filtering . . . . . . 8-29

Apply Multiple Filters to Integral Image . . . . . . . . . . . . . . . . . . . . . . . . . . 8-33

Reduce Noise in Image Gradients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-38

Design Linear Filters in the Frequency Domain . . . . . . . . . . . . . . . . . . . . 8-47


Two-Dimensional Finite Impulse Response (FIR) Filters . . . . . . . . . . . . . 8-47
Transform 1-D FIR Filter to 2-D FIR Filter . . . . . . . . . . . . . . . . . . . . . . . 8-47
Frequency Sampling Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-49
Windowing Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-50
Creating the Desired Frequency Response Matrix . . . . . . . . . . . . . . . . . . 8-51
Computing the Frequency Response of a Filter . . . . . . . . . . . . . . . . . . . . 8-52

Transforms
9
Fourier Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
Definition of Fourier Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
Discrete Fourier Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5
Applications of the Fourier Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8

Discrete Cosine Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12


DCT Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12
The DCT Transform Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-13
Image Compression with the Discrete Cosine Transform . . . . . . . . . . . . . 9-13

Hough Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16


Detect Lines in Images Using Hough . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16

Radon Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-21


Plot the Radon Transform of an Image . . . . . . . . . . . . . . . . . . . . . . . . . . 9-23
Viewing the Radon Transform as an Image . . . . . . . . . . . . . . . . . . . . . . . 9-25

Detect Lines Using the Radon Transform . . . . . . . . . . . . . . . . . . . . . . . . . 9-27

xii Contents
The Inverse Radon Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-32
Inverse Radon Transform Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-32
Reconstructing an Image from Parallel Projection Data . . . . . . . . . . . . . . 9-34

Fan-Beam Projection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-37


Image Reconstruction from Fan-Beam Projection Data . . . . . . . . . . . . . . 9-39
Reconstruct Image using Inverse Fanbeam Projection . . . . . . . . . . . . . . . 9-40

Reconstructing an Image from Projection Data . . . . . . . . . . . . . . . . . . . . 9-44

Morphological Operations
10
Types of Morphological Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2
Morphological Dilation and Erosion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2
Operations Based on Dilation and Erosion . . . . . . . . . . . . . . . . . . . . . . . 10-4

Structuring Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-9


Determine the Origin of a Structuring Element . . . . . . . . . . . . . . . . . . . 10-10
Structuring Element Decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-11

Border Padding for Morphology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13

Morphological Reconstruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-14


Understanding the Marker and Mask . . . . . . . . . . . . . . . . . . . . . . . . . . 10-15
Finding Peaks and Valleys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-16

Pixel Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22


Defining Connectivity in an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22
Choosing a Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23
Specifying Custom Connectivities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23

Lookup Table Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-25


Creating a Lookup Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-25
Using a Lookup Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-25

Dilate an Image to Enlarge a Shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-27

Remove Thin Lines Using Erosion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-31

Use Morphological Opening to Extract Large Image Features . . . . . . . 10-33

Flood-Fill Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-38


Specifying Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-38
Specifying the Starting Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-38
Filling Holes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-39

Detect Cell Using Edge Detection and Morphology . . . . . . . . . . . . . . . . 10-41

Granulometry of Snowflakes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-46

xiii
Distance Transform of a Binary Image . . . . . . . . . . . . . . . . . . . . . . . . . . 10-50

Label and Measure Connected Components in a Binary Image . . . . . . 10-52


Detect Connected Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-52
Label Connected Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-53
Select Objects in a Binary Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-54
Measure Properties of Connected Components . . . . . . . . . . . . . . . . . . . 10-54

Analyzing and Enhancing Images


11
Pixel Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3
Determine Values of Individual Pixels in Images . . . . . . . . . . . . . . . . . . . 11-3

Intensity Profile of Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-5


Create an Intensity Profile of an Image . . . . . . . . . . . . . . . . . . . . . . . . . . 11-5
Create Intensity Profile of an RGB Image . . . . . . . . . . . . . . . . . . . . . . . . 11-6

Contour Plot of Image Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8


Create Contour Plot of Image Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8

Measuring Regions in Grayscale Images . . . . . . . . . . . . . . . . . . . . . . . . . 11-10

Finding the Length of a Pendulum in Motion . . . . . . . . . . . . . . . . . . . . . 11-16

Create Image Histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-22

Image Mean, Standard Deviation, and Correlation Coefficient . . . . . . . 11-24

Edge Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-25


Detect Edges in Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-25

Boundary Tracing in Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-27


Trace Boundaries of Objects in Images . . . . . . . . . . . . . . . . . . . . . . . . . 11-27
Select First Step and Direction for Tracing . . . . . . . . . . . . . . . . . . . . . . 11-30

Quadtree Decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-32


Perform Quadtree Decomposition on an Image . . . . . . . . . . . . . . . . . . . 11-32

Detect and Measure Circular Objects in an Image . . . . . . . . . . . . . . . . . 11-35

Identifying Round Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-48

Measuring Angle of Intersection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-56

Measuring the Radius of a Roll of Tape . . . . . . . . . . . . . . . . . . . . . . . . . . 11-62

Calculate Statistical Measures of Texture . . . . . . . . . . . . . . . . . . . . . . . . 11-65

Texture Analysis Using the Gray-Level Co-Occurrence Matrix (GLCM)


........................................................ 11-67

xiv Contents
Create a Gray-Level Co-Occurrence Matrix . . . . . . . . . . . . . . . . . . . . . . . 11-68

Specify Offset Used in GLCM Calculation . . . . . . . . . . . . . . . . . . . . . . . . 11-69

Derive Statistics from GLCM and Plot Correlation . . . . . . . . . . . . . . . . . 11-70

Adjust Image Intensity Values to Specified Range . . . . . . . . . . . . . . . . . 11-72

Gamma Correction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-74


Specify Gamma when Adjusting Contrast . . . . . . . . . . . . . . . . . . . . . . . 11-74

Contrast Enhancement Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-76

Specify Contrast Adjustment Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-80


Specify Contast Adjustment Limits as Range . . . . . . . . . . . . . . . . . . . . 11-80
Set Image Intensity Adjustment Limits Automatically . . . . . . . . . . . . . . 11-81

Histogram Equalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-82


Adjust Intensity Values Using Histogram Equalization . . . . . . . . . . . . . 11-82
Plot Transformation Curve for Histogram Equalization . . . . . . . . . . . . . 11-84

Adaptive Histogram Equalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-86


Adjust Contrast using Adaptive Histogram Equalization . . . . . . . . . . . . 11-86

Enhance Color Separation Using Decorrelation Stretching . . . . . . . . . 11-88


Simple Decorrelation Stretching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-88
Linear Contrast Stretching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-92
Decorrelation Stretch with Linear Contrast Stretch . . . . . . . . . . . . . . . 11-92

Enhance Multispectral Color Composite Images . . . . . . . . . . . . . . . . . . 11-94

Low-Light Image Enhancement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-104

Apply Gaussian Smoothing Filters to Images . . . . . . . . . . . . . . . . . . . . 11-114

Noise Removal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-120


Remove Noise by Linear Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-120
Remove Noise Using an Averaging Filter and a Median Filter . . . . . . . 11-120
Remove Noise By Adaptive Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . 11-123

Compute 3-D Superpixels of Input Volumetric Intensity Image . . . . . 11-126

Image Quality Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-129


Full-Reference Quality Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-129
No-Reference Quality Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-130

Train and Use No-Reference Quality Assessment Model . . . . . . . . . . . 11-131


NIQE Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-131
BRISQUE Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-133

Obtain Local Structural Similarity Index . . . . . . . . . . . . . . . . . . . . . . . 11-135

Compare Image Quality at Various Compression Levels . . . . . . . . . . . 11-137

xv
Anatomy of Imatest Extended eSFR Chart . . . . . . . . . . . . . . . . . . . . . . 11-139
Slanted Edge Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-139
Gray Patch Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-140
Color Patch Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-141
Registration Markers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-141

Evaluate Quality Metrics on eSFR Test Chart . . . . . . . . . . . . . . . . . . . . 11-143

Correct Colors Using Color Correction Matrix . . . . . . . . . . . . . . . . . . . 11-155

Install Sample Data Using Add-On Explorer . . . . . . . . . . . . . . . . . . . . . 11-162

ROI-Based Processing
12
Create a Binary Mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2
Create a Binary Mask from a Grayscale Image . . . . . . . . . . . . . . . . . . . . 12-2
Create Binary Mask Using an ROI Function . . . . . . . . . . . . . . . . . . . . . . 12-2
Create Binary Mask Based on Color Values . . . . . . . . . . . . . . . . . . . . . . . 12-4
Create Binary Mask Without an Associated Image . . . . . . . . . . . . . . . . . 12-4

ROI Creation Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-5


Create ROI Using Creation Convenience Functions . . . . . . . . . . . . . . . . . 12-8
Create ROI Using draw Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10
Using ROIs in Apps Created with App Designer . . . . . . . . . . . . . . . . . . 12-14

ROI Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16


ROI Object Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16
ROI Object Function Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16
ROI Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-18

Overview of ROI Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-19

Sharpen Region of Interest in an Image . . . . . . . . . . . . . . . . . . . . . . . . . 12-20

Apply Custom Filter to Region of Interest in Image . . . . . . . . . . . . . . . . 12-23

Fill Region of Interest in an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-26

Calculate Properties of Image Regions Using Image Region Analyzer


........................................................ 12-28

Filter Images on Properties Using Image Region Analyzer App . . . . . . 12-33

Create Image Comparison Tool Using ROIs . . . . . . . . . . . . . . . . . . . . . . 12-37

Use Freehand ROIs to Refine Segmentation Masks . . . . . . . . . . . . . . . . 12-44

Rotate Rectangle ROI to interact with imrotate . . . . . . . . . . . . . . . . . . . 12-49

Subsample or Simplify a Freehand ROI . . . . . . . . . . . . . . . . . . . . . . . . . . 12-54

xvi Contents
Measure Distances in an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-64

Use Polyline to Create An Angle Measurement Tool . . . . . . . . . . . . . . . 12-71

Create Freehand ROI Editing Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-74

Use Wait Function After Drawing ROI . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-80

Interactive Image Inpainting Using Exemplar Matching . . . . . . . . . . . . 12-83

Image Segmentation
13
Texture Segmentation Using Gabor Filters . . . . . . . . . . . . . . . . . . . . . . . . 13-2

Texture Segmentation Using Texture Filters . . . . . . . . . . . . . . . . . . . . . . . 13-7

Color-Based Segmentation Using the L*a*b* Color Space . . . . . . . . . . . 13-15

Color-Based Segmentation Using K-Means Clustering . . . . . . . . . . . . . 13-21

Marker-Controlled Watershed Segmentation . . . . . . . . . . . . . . . . . . . . . 13-26

Segment Image and Create Mask Using Color Thresholder App . . . . . 13-42

Acquire Live Images in the Color Thresholder App . . . . . . . . . . . . . . . . 13-55

Image Segmentation Using Point Clouds in the Color Thresholder App


........................................................ 13-61

Getting Started with Image Segmenter App . . . . . . . . . . . . . . . . . . . . . . 13-68


Open Image Segmenter App and Load Data . . . . . . . . . . . . . . . . . . . . . 13-68
Create and Add Regions to Segmented Mask . . . . . . . . . . . . . . . . . . . . 13-68
Refine Segmented Mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-69
Export Segmentation Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-70

Segment Image Using Thresholding in Image Segmenter . . . . . . . . . . 13-71

Segment Image By Drawing Regions Using Image Segmenter . . . . . . . 13-75

Segment Image Using Active Contours in Image Segmenter . . . . . . . . 13-81

Refine Segmentation Using Morphology in Image Segmenter . . . . . . . 13-87

Segment Image Using Graph Cut in Image Segmenter . . . . . . . . . . . . . 13-92

Segment Image Using Local Graph Cut (Grabcut) in Image Segmenter


....................................................... 13-101

Segment Image Using Find Circles in Image Segmenter . . . . . . . . . . 13-110

xvii
Segment Image Using Auto Cluster in Image Segmenter . . . . . . . . . . 13-117

Plot Land Classification with Color Features and Superpixels . . . . . . 13-123

Segment Lungs from 3-D Chest Scan . . . . . . . . . . . . . . . . . . . . . . . . . . 13-126

Image Deblurring
14
Image Deblurring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2
Deblurring Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-3

Deblur Images Using a Wiener Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-5

Deblur Images Using a Regularized Filter . . . . . . . . . . . . . . . . . . . . . . . 14-12

Adapt the Lucy-Richardson Deconvolution for Various Image Distortions


........................................................ 14-22
Reduce the Effect of Noise Amplification . . . . . . . . . . . . . . . . . . . . . . . 14-22
Account for Nonuniform Image Quality . . . . . . . . . . . . . . . . . . . . . . . . . 14-22
Handle Camera Read-Out Noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-23
Handling Undersampled Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-23
Refine the Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-23

Deblurring Images Using the Lucy-Richardson Algorithm . . . . . . . . . . 14-25

Adapt Blind Deconvolution for Various Image Distortions . . . . . . . . . . 14-37


Deblur images using blind deconvolution . . . . . . . . . . . . . . . . . . . . . . . 14-37
Refining the Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-45

Deblurring Images Using the Blind Deconvolution Algorithm . . . . . . . 14-46

Create Your Own Deblurring Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 14-54

Avoid Ringing in Deblurred Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-55

Color
15
Display Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2

Reduce the Number of Colors in an Image . . . . . . . . . . . . . . . . . . . . . . . . 15-3


Reduce Colors of Truecolor Image Using Color Approximation . . . . . . . . 15-3
Reduce Colors of Indexed Image Using imapprox . . . . . . . . . . . . . . . . . . 15-7
Reduce Colors Using Dithering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-7

Profile-Based Color Space Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10


Read ICC Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10

xviii Contents
Write ICC Profile Information to a File . . . . . . . . . . . . . . . . . . . . . . . . . 15-10
Convert RGB to CMYK Using ICC Profiles . . . . . . . . . . . . . . . . . . . . . . . 15-11
What is Rendering Intent in Profile-Based Conversions? . . . . . . . . . . . . 15-12

Device-Independent Color Spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-13


Convert Between Device-Independent Color Spaces . . . . . . . . . . . . . . . 15-13
Color Space Data Encodings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-13

Understanding Color Spaces and Color Space Conversion . . . . . . . . . . 15-15


RGB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-15
HSV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-16
CIE 1976 XYZ and CIE 1976 L*a*b* . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-17
YCbCr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-18
YIQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-19

Convert Between RGB and HSV Color Spaces . . . . . . . . . . . . . . . . . . . . 15-20

Determine If L*a*b* Value Is in RGB Gamut . . . . . . . . . . . . . . . . . . . . . . 15-24

Comparison of Auto White Balance Algorithms . . . . . . . . . . . . . . . . . . . 15-25

Big Image Processing


16
Set Spatial Referencing for Big Images . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2

Process Big Images Efficiently Using Partial Images or Lower Resolutions


......................................................... 16-8

Process Big Images Efficiently Using Mask . . . . . . . . . . . . . . . . . . . . . . 16-17

Explore Big Image Details with Interactive ROIs . . . . . . . . . . . . . . . . . . 16-28

Warp Big Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-35

Create Labeled bigimage from ROIs and Masks . . . . . . . . . . . . . . . . . . . 16-40

Neighborhood and Block Operations


17
Neighborhood or Block Processing: An Overview . . . . . . . . . . . . . . . . . . . 17-2

Sliding Neighborhood Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3


Determine the Center Pixel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3
General Algorithm of Sliding Neighborhood Operations . . . . . . . . . . . . . 17-4
Border Padding Behavior in Sliding Neighborhood Operations . . . . . . . . 17-4
Implementing Linear and Nonlinear Filtering as Sliding Neighborhood
Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-4

xix
Distinct Block Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-6
Implement Block Processing Using the blockproc Function . . . . . . . . . . . 17-6
Apply Padding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-7

Block Size and Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-9


TIFF Image Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-9
Choose Block Size to Optimize blockproc Performance . . . . . . . . . . . . . . 17-9

Parallel Block Processing on Large Image Files . . . . . . . . . . . . . . . . . . . 17-12


What is Parallel Block Processing? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-12
When to Use Parallel Block Processing . . . . . . . . . . . . . . . . . . . . . . . . . 17-12
How to Use Parallel Block Processing . . . . . . . . . . . . . . . . . . . . . . . . . . 17-12

Perform Block Processing on Image Files in Unsupported Formats . . . 17-14


Learning More About the LAN File Format . . . . . . . . . . . . . . . . . . . . . . 17-14
Parsing the Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-14
Reading the File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-15
Examining the LanAdapter Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-16
Using the LanAdapter Class with blockproc . . . . . . . . . . . . . . . . . . . . . 17-19

Use Column-wise Processing to Speed Up Sliding Neighborhood or


Distinct Block Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-20
Using Column Processing with Sliding Neighborhood Operations . . . . . 17-20
Using Column Processing with Distinct Block Operations . . . . . . . . . . . 17-21

Block Processing Large Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-23

Compute Statistics for Large Images . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-28

Deep Learning
18
Train and Apply Denoising Neural Networks . . . . . . . . . . . . . . . . . . . . . . 18-2
Remove Gaussian Noise Using Pretrained Network . . . . . . . . . . . . . . . . 18-2
Train a Denoising Network Using Built-In Layers . . . . . . . . . . . . . . . . . . 18-2
Train Fully Customized Denoising Neural Network . . . . . . . . . . . . . . . . . 18-3

Remove Noise from Color Image Using Pretrained Neural Network . . . 18-5

Single Image Super-Resolution Using Deep Learning . . . . . . . . . . . . . . 18-11

JPEG Image Deblocking Using Deep Learning . . . . . . . . . . . . . . . . . . . . 18-25

Image Processing Operator Approximation Using Deep Learning . . . . 18-38

Semantic Segmentation of Multispectral Images Using Deep Learning


........................................................ 18-53

3-D Brain Tumor Segmentation Using Deep Learning . . . . . . . . . . . . . . 18-70

Deep Learning Classification of Large Multiresolution Images . . . . . . 18-82

xx Contents
Neural Style Transfer Using Deep Learning . . . . . . . . . . . . . . . . . . . . . 18-103

Code Generation for Image Processing Toolbox Functions


19
Code Generation for Image Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2
Code Generation Using a Shared Library . . . . . . . . . . . . . . . . . . . . . . . . 19-2

List of Supported Functions with Usage Notes . . . . . . . . . . . . . . . . . . . . . 19-4

Code Generation with Cell Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8


Setup Your Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8
Generate Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8

GPU Computing with Image Processing Toolbox Functions


20
Image Processing on a GPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-2

List of Supported Functions with Limitations and Other Notes . . . . . . . 20-3

Perform Thresholding and Morphological Operations on a GPU . . . . . . 20-6

Perform Element-Wise Operations on a GPU . . . . . . . . . . . . . . . . . . . . . 20-10

xxi
1

Getting Started

This topic presents two examples to get you started doing image processing using MATLAB® and the
Image Processing Toolbox software. The examples contain cross-references to other sections in the
documentation that have in-depth discussions on the concepts presented in the examples.

• “Image Processing Toolbox Product Description” on page 1-2


• “Configuration Notes” on page 1-3
• “Compilability” on page 1-4
• “Basic Image Import, Processing, and Export” on page 1-5
• “Correct Nonuniform Illumination and Analyze Foreground Objects” on page 1-10
• “Getting Help” on page 1-18
• “Acknowledgments” on page 1-19
1 Getting Started

Image Processing Toolbox Product Description


Perform image processing, visualization, and analysis

Image Processing Toolbox provides a comprehensive set of reference-standard algorithms and


workflow apps for image processing, analysis, visualization, and algorithm development. You can
perform image segmentation, image enhancement, noise reduction, geometric transformations, and
image registration using deep learning and traditional image processing techniques. The toolbox
supports processing of 2D, 3D, and arbitrarily large images.

Image Processing Toolbox apps let you automate common image processing workflows. You can
interactively segment image data, compare image registration techniques, and batch-process large
datasets. Visualization functions and apps let you explore images, 3D volumes, and videos; adjust
contrast; create histograms; and manipulate regions of interest (ROIs).

You can accelerate your algorithms by running them on multicore processors and GPUs. Many
toolbox functions support C/C++ code generation for desktop prototyping and embedded vision
system deployment.

Key Features
• Image analysis, including segmentation, morphology, statistics, and measurement
• Apps for image region analysis, image batch processing, and image registration
• 3D image processing workflows, including visualization and segmentation
• Image enhancement, filtering, geometric transformations, and deblurring algorithms
• Intensity-based and non-rigid image registration methods
• Support for CUDA enabled NVIDIA GPUs (with Parallel Computing Toolbox™)
• C-code generation support for desktop prototyping and embedded vision system deployment

1-2
Configuration Notes

Configuration Notes
To determine if the Image Processing Toolbox software is installed on your system, type this
command at the MATLAB prompt.

ver

When you enter this command, MATLAB displays information about the version of MATLAB you are
running, including a list of all toolboxes installed on your system and their version numbers. For a list
of the new features in this version of the toolbox, see the Release Notes documentation.

Many of the toolbox functions are MATLAB files with a series of MATLAB statements that implement
specialized image processing algorithms. You can view the MATLAB code for these functions using
the statement

type function_name

You can extend the capabilities of the toolbox by writing your own files, or by using the toolbox in
combination with other toolboxes, such as the Signal Processing Toolbox™ software and the Wavelet
Toolbox™ software.

For information about installing the toolbox, see the installation guide.

For the most up-to-date information about system requirements, see the system requirements page,
available in the products area at the MathWorks Web site (www.mathworks.com).

1-3
1 Getting Started

Compilability
The Image Processing Toolbox software is compilable with the MATLAB Compiler™ except for the
following functions that launch GUIs:

• cpselect
• implay
• imtool

1-4
Exploring the Variety of Random
Documents with Different Content
Gather them fresh. Pare, slice and lay them in salt and water; just
before dinner, pour off the water; season with pepper, salt, vinegar
and onions.

SQUASHES.
Squashes should be young and tender; try them with a fork; if they
are old, do not use them. Peel them and take out the seed; cut them
in pieces and boil till tender; when done, pass them through a
cullender. Stew with butter, pepper, salt and a little cream; send
them hot to table.

TO BOIL BEETS.
The early turnip beet is best in summer: wash them, but do not cut
the tops too close, as they are much sweeter with some of the tops
boiled on them. They will boil in three quarters of an hour; when
done, take them up, put them in cold water for a moment, so that
the skin will easily peel off. Slice them, and season with pepper, salt
and butter. Old, or winter beets, will take much longer. They will take
from two to three hours to boil. It is better to put them to soak over
night, if they are very solid: cut them in slices, and pour vinegar
over them.

TO COOK ONIONS.
The small white onions are preferred. Peel them, and put them down
in a little water and salt; when nearly done, pour off the water, and
add milk and a little flour mixed with butter.
TO KEEP VEGETABLES FOR WINTER.
Salsify, parsnips, beets, and carrots should be gathered in the early
part of November. Those you want to use during the winter should
be put in boxes, and covered with sand. Celery should be put in a
box with the roots down, covered with sand. Some gardeners keep it
in the ground all winter, and dig it as they wish it, for use.

TO STEW MUSHROOMS.
Wash and peel the mushrooms; put them down in a stew pan with a
little water, pepper, salt and butter; let them stew slowly for ten or
fifteen minutes; then take them up. They are very good broiled.

HOT OR COLD SLAW.


The hard white cabbage is the best for slaw. Wash it well, and cut it
fine; have some butter boiling hot; put in the slaw and keep stirring
till it is shrivelled: then beat up some vinegar and the yolk of an egg:
season with pepper and salt; pour this in the pan over the slaw, and
stir in till quite hot: send to table either hot or cold, as preferred.

COLD SLAW.
Cut fine some hard cabbage; dress with hard-boiled eggs, oil,
vinegar, mustard, pepper and salt.

TO BOIL CABBAGE.
Wash your cabbage well; cut it in two, and boil till tender in salt and
water. Some persons prefer it boiled with a piece of pork or bacon. If
it is boiled with bacon, the pot should be well skimmed before the
cabbage goes in.

BROCOLI.
Pick and wash it well; tie it up in bunches and boil it; when done,
drain it and serve it up with drawn butter. Put a little salt in the
water when nearly boiled.

SEA KALE.
Sea kale is cooked in the same way as brocoli.

BUTTER.
In winter the pans should be scalded before the milk is strained into
them; in summer the pans and strainer should be rinsed with cold
water. Do not cover the milk until it is perfectly cold; a stone crock is
the best for keeping the cream in, and it should be stirred two or
three times a day; if the cream is not stirred, the butter will have a
bad taste; do not let your milk stand too long, or this will make the
butter taste very unpleasant. Be particular to put cold water in your
churn the night before you wish to use it; pour it out in the morning,
and rinse it again; before the butter comes, or while it is gathering,
take off the lid of the churn; have your butter-bowl scalded and
cooled; work the milk out well, but do not put in any water; add salt
to your taste. Everything connected with milk or butter should be
kept very carefully clean.
TO KEEP BUTTER.
Butter, to keep, should be well worked; pack it in stone jars, and tie
it up tight, and set it in a cool place.

TO KEEP EGGS.
Get eggs as fresh as possible; put a layer of salt in a jar; then put in
some eggs, the small end down, then another layer of salt, then the
eggs; be careful not to let the eggs touch each other; set them in a
dry cool place, and they will keep all winter.

TO MAKE COFFEE.
Coffee should be roasted with great care, to a dark brown colour,
stirring it all the time it is on the fire, with a long-handled iron
spoon; when it is done, put it in a stone jar, and cover it up. Freshly
roasted coffee is much the best; grind it into a bowl, beat it up with
part of the white of an egg, and cold water; put it into the tin coffee-
pot, and pour on it boiling water, out of a tea-kettle, stirring it all the
while; set it on the fire, and let it boil fifteen minutes; stir it
frequently from the sides of the pot; when it is done, set it a
moment on the hearth, and it will settle; do not pour into it either
cold or warm water, or coffee, to settle it: this spoils the coffee. Pour
it into your silver or china coffee pot, and send to table.

TO MAKE TEA.
Black tea should be boiled fifteen or twenty minutes. Green tea
should not boil: but have boiling water poured on about five minutes
before it comes to table.
TO MAKE CHOCOLATE.
Have a quart of good milk boiling; grate a piece of chocolate three
inches square; mix it with a little cold milk; then stir it gradually into
the milk on the fire. If preferred thinner, use less chocolate. It should
boil at least half an hour.

YEAST.
Pare six good-sized potatoes; put them on to boil with three pints of
water and a handful of hops; pour the water through a sieve on a
pint of flour; stir it until perfectly smooth; mash your potatoes
through a cullender into the yeast; stir all well together, and let it
stand till nearly cold; then stir into it a pint bowl half full of dry
yeast, dissolved in water; put the water on the dry yeast as soon as
you mix your flour and potatoes, and when it has sufficiently cooled,
your yeast will be ready to go in. Set it in a warm place to rise.
When it is light enough, keep it in a cool place; cover it close. Yeast
should be made the day before you bake; then it is good and fresh.

TO MAKE DRY YEAST.


Make as directed above. When perfectly light, stir in corn meal till it
is quite dry; spread it on dishes to dry. Be careful not to let it be in
the sun, as this would sour it. When dry, put it in a bag, in a dry,
cool place. In summer time, when the flies are numerous, spread a
thin piece of gauze over to keep them off when it is drying.

BREAD.
Sift the flour; put it in an earthen vessel; the quantity of flour you
take will depend upon the number of loaves you want. Four loaves
of bread will require two quarts of water; pour the water, which may
be as warm as milk just from the cow, upon the flour, enough to
make a thick batter; put in two tablespoonsful of salt, and a pint of
home-made yeast; do not beat it after the yeast goes in. Set it in a
warm place to rise; when it is light, work it very well with flour. The
more you knead it, the better. If the flour is running, the bread will
require to be made stiffer than when it is superfine flour. Let it rise
again, covering it, and set it in a warm place. When it is broken on
top, make it into loaves, with as little flour as possible. Put each loaf
into a basket: cover it over, and set it to rise again. When quite light,
bake it in a brick oven, from three quarters to one hour.

TO BAKE IN A BRICK OVEN.


A brick oven will require one hour to heat. The wood should be split
fine; make a little fire at first, then add more wood; when the oven
is white at the top, it is sufficiently hot. Spread the coals over the
bottom of the oven, and let them remain a quarter of an hour.

Rusk or biscuit, if they are very light, will bake in from ten to fifteen
minutes. Bread requires one hour.

PHILADELPHIA BUNNS.
One pound of flour, and a half pound of sugar, one pint of milk, with
one teaspoonful of soda, a few currants, and half a pound of butter,
a tea-cup full of yeast. Mix all well, and let it rise; when well risen,
put in six eggs, beaten separately: pour it in the pans, and let it rise
again; then bake.
BREAD ROLLS.
When your bread is very light, take a piece of dough, into which rub
a small piece of butter; make them into rolls a quarter of an inch
thick: let them rise, and bake.

DIET BREAD.
Rub into a pound of flour, one tablespoonful of butter, and a
teaspoonful of salt: work it very well, or beat it; roll very thin: stick
with a fork, and bake.

MUSH ROLLS.
Have a pint of corn mush; when a little warm, add a little salt and
flour, enough to make a dough; add a tea-cup full of yeast; let it
rise, and when quite light, make into rolls; let them rise again, and
bake. You can put a little butter with them, if you prefer: but they
are very palatable without.

RISEN MUFFINS.
Warm a quart of milk, into which put a quarter pound of butter,
enough flour to make a batter, two eggs, well beaten, and a cup of
yeast, a little salt; when quite light, bake in rings. Do not beat them
after the yeast is in: they will be light enough in three hours.

SODA CAKES, VERY SUPERIOR.


Sift into three pints of flour, three teaspoonsful of cream of tartar;
rub one quarter of a pound of butter in the flour; dissolve one
teaspoonful of soda in as much milk as will make a dough, thick
enough to roll out; then take a large spoonful, sift flour on the
board, roll out and bake: do not touch them with the hands.

PHILADELPHIA MILK BISCUIT.


Rub half a pound of butter in three pounds of flour, a teaspoonful of
salt; warm the milk and pour on enough to make a thick batter; beat
it well, then add a cup of good yeast. Do not beat it after the yeast
goes in; let it rise; when quite light mix in flour, enough to make it
out, but as little as possible: roll it out and cut into cakes with a
small tumbler: let them rise again, and bake as soon as light.

TWIST ROLLS.
Twist rolls are made in the same way, only make in small twists or
rings, and bake.

LIGHT BISCUIT.
Have a quart of milk a little warm, into which put two spoonsful of
butter; pour this on flour, enough to make a dough; add a tea-cup
full of yeast, and a little salt; let it rise three hours, when roll into
cakes: put them in pans: let them rise again, and bake.

TEA BISCUIT.
Warm a pint of good milk, into which put a piece of butter, the size
of an egg; pour this on some flour, with a little salt and a tea-cup full
of yeast. When quite light, knead it well; roll out and bake in pans.
When done, pull them open and butter them.

GERMAN CAKES.
Cut up into a pound of flour, lard the size of an egg, and a little salt;
milk sufficient to make a dough; roll out very thin, and bake. These
cakes can be fried in lard, in round cakes, and are then called snow-
balls.

MARYLAND BISCUIT.
Cut up a quarter of a pound of lard and butter, into two pounds of
flour; add a little salt and water enough to make a stiff dough; beat
very light with an axe, till it will break off short: stick with a fork, and
bake in a quick oven. To be made up in small cakes.

BUCKWHEAT CAKES.
In a quart of buckwheat meal, put a cup of Indian or wheat flour,
whichever is preferred. Make this into a batter, with water, a little
warm, a cup of yeast and a little salt. Set it to rise, and when quite
light, pour it on the griddle. It is better to set them to rise in a
pitcher, as stirring the batter spoils them.

FLANNEL CAKES.
Make a batter of a pint of milk, sufficiently warm to melt in it a piece
of butter the size of an egg, two eggs, a little salt and flour; put in a
cup of yeast, and set it to rise three hours: bake on the griddle. If
you wish them quick, make them of soda and cream of tartar, one
third soda, and two thirds cream of tartar, or yeast powder.

SALLY LUNN.
Take a pint of milk and water mixed; warm it, and melt a small piece
of butter in it. Put in flour enough to make a stiff batter. Two eggs
and a cup of good yeast, a little salt, but no sugar. Set it in a warm
place to rise. Send to table whole. This quantity will take near an
hour to bake: do not beat it after the yeast goes in.

POTATO BREAD OR ROLLS.


Take some mealy potatoes, mash them fine in some flour, a small
piece of butter, a little salt and some yeast; when light, roll out in
cakes: put them in pans, and set them away to rise, and when light,
bake.

MUSH MUFFINS.
Take a pint of corn mush, and when milk warm, put in a lump of
butter, a little milk, two eggs, and flour enough to make a batter;
add a little salt and one cup full of yeast. Set to rise for three hours:
bake in rings.

RICE MUFFINS.
Take a cup full of boiled rice, and a piece of butter, the size of an
egg; pour upon this a quart of boiling milk; add a little salt and two
eggs well beaten; when cool, a tea-cup full of yeast and flour,
enough to make a stiff batter: when light, bake in rings.

QUICK MUFFINS.
One and a half pints of milk to a quart of flour, an even
tablespoonful of butter, two eggs; sift with the flour two
teaspoonsful of cream of tartar, and dissolve with a little milk and a
teaspoon three quarters full of soda: bake immediately.

QUICK WAFFLES.
Quick waffles are made with sour cream. To one quart of sour cream
add flour enough to make a batter, two eggs well beaten, a small
piece of butter, and one teaspoonful of soda; just before baking, a
little salt; bake immediately: a little boiled rice will be a great
improvement.

REMARKS ON MAKING INDIAN BREAD.


It is better in making Indian bread to pour the liquid, either water or
milk, boiling hot on the Indian meal. Indian takes more salt than
wheat.

TO MAKE MUSH.
Have a pot of boiling water. Stir in gradually corn meal to make it
thick. Salt it to your taste: let it boil one hour. When it is cold, slice it
and fry it a light brown: send to table hot.

CORN BATTER CAKES.


Pour boiling milk on meal, enough to make a batter; add a little salt
and two eggs. The eggs will prevent them breaking when they are
turned: send hot to table. If this batter is made thick and baked in a
pan, it is called pone.

JOURNEY CAKE.
Mix well some corn meal with water, and a little salt. Have ready the
middle board of a flour barrel-head; wet the board, upon which put
the dough with a large spoon; smooth it over; bake before the fire;
when baked brown, turn the other side. Send hot to table.

LIGHTENED PONE.
Pour either milk or water boiling hot on a pint of corn meal; add salt,
and, when it is cool, some yeast and two eggs; when it is light, it will
open at top: bake in pans an inch thick.

INDIAN BREAKFAST CAKES.


Upon one quart of corn meal, pour one quart of boiling milk, with a
small piece of butter, a spoonful of salt, a spoonful of cream of
tartar, and a half one of soda sifted with the meal; when well mixed
drop them into a pan, and bake in an oven: these cakes must be
rough on top.

POTATO CAKES.
Boil ten mealy potatoes, put to them a piece of butter the size of an
egg, some salt and flour, enough to roll them out; bake them in
cakes, on the griddle: send hot to table.

TO MAKE PUFF PASTE.


Take one pound and a half of flour; sift half of it into a tin pan. The
remainder keep for rolling out the paste; take a pound of butter
which has been washed and well worked the night before, and kept
in a cold place. Cut up half of it with two knives into the flour, then
mix it with a tumbler of ice water. Then roll it out very thin, and
spread on it in small thin pieces a quarter of a pound of butter, and
sift flour over it. Cut it in strips, about four inches wide, and six long;
lay one upon another till they are all on; then roll again, and put the
remaining quarter of butter on as before; roll and cut it in strips, and
those strips in squares, and lay one upon another. When you make
the pie do not take one of the strips, but cut it down, so as to have
as many layers as possible in each pie. Always use the knives: never
touch the paste with the hand.

ANOTHER VERY SUPERIOR PUFF PASTE.


One pound and a quarter of flour, and one of butter. The butter
should be divided into four parts, and the salt well washed out of it
in three different waters, the night before, and set in a cold place to
become hard, the harder the better. Weigh a pound and a quarter of
flour; sift half a pound of the flour into a tin pan, (such a pan as
should be always kept for making pastry,) keep the rest of the flour
in the sieve. Cut up in the pan with the half pound of flour, a quarter
of a pound of butter with two knives. (The hands should never touch
the pastry.) Then pour slowly into the pan half a pint of ice water;
mixing it with the knives. Sift some of the flour on your board, and
roll it out very thin, with a floured rolling pin; sufficient flour must be
used to prevent it sticking to the board; put over the paste in small
pieces as regularly as possible, one quarter of butter; then sift flour
over and cut it in strips about three inches wide; then cut across as
many times, placing one piece upon another till it makes quite a high
mound. Flour it and roll it out again as thin as possible. Then put on
in very small pieces the third quarter of butter, and proceed as
above, with the last quarter; roll out very thin, cutting it as before.
The flour is now all rolled in except half of a pound, reserved for
rolling out the paste when making up. It should be made in a cold
place, and near an open window. When you make up your pies cut a
piece from top to bottom of the pile, and roll out thin. The fire
should be under pastry to make it puff up. There is nothing better
for baking pastry than a ten plate stove.

VERY SUPERIOR MINCE PIES.


Take a fresh tongue and some of the neck, four pounds in all; two
pounds of suet, four pounds of raisins, two of currants, two of
citron, six pounds of sugar, one quart of brandy, one of Madeira
wine, and half a peck of apples. Cinnamon, nutmeg, cloves, and very
little salt.

CURRANT PIES.
Pick and scald your currants; let them stand a few minutes, then
pour off the water. Some prefer them stewed. Sugar to your taste.
Gooseberries are prepared in the same way.

RHUBARB PIE.
Take off the skin; cut in small pieces; sugar them and put them in
the paste, and bake. Some prefer them stewed.

BLACKBERRY PIE.
Wash your blackberries; put them in the paste, with sugar to your
taste: bake, and send hot to table. These pies are not good, if they
stand long after being baked.

PEACH PIES.
Pare your peaches; cut them in slices; put them in your paste with
sugar and a little water, and bake slowly.

FLORENDINES.
Boil a quart of milk; stir into it four tablespoonsful of rice flour; let it
boil ten minutes, then add a tea-cup full of powdered loaf sugar,
grated nutmeg, a gill of cream, and five eggs beaten very light.
Make a puff paste, and bake.

CREAM PUDDING.
To one cup of cream, add two tablespoonsful of rice flour, and two
eggs; a few currants, sugar, and rose water, to your taste: bake in
paste.

INDIAN PUDDING.
Pour one quart of boiling milk over a half pint of corn meal; add two
tablespoonsful of butter, and four of molasses; beat four eggs very
light; and, when perfectly cool, add them, with a glass of brandy,
and mace and nutmeg: bake, and send to table hot with wine sauce.

RICE PUDDING.
Take half a pint of rice; wash it well; put it on to boil with very little
water, and let it boil dry; then stir in a piece of butter the size of a
goose egg; a grated nutmeg, a tea-cup full of loaf sugar, a quart of
milk, and two eggs well beaten: pour it into a pudding dish, and
bake.

COCOANUT PUDDING.
Grate one cocoanut; pour the milk on some sugar, then boil it, and
throw in the cocoanut; let it come to a boil again. When cold, add
four eggs well beaten: bake in puff paste.

BREAD PUDDING.
Take the inside of a stale loaf of baker’s bread; pour over it one
quart of boiling milk; when perfectly cold, add five eggs well beaten,
one cup full of sugar, a small piece of butter, a little brandy, mace,
and nutmeg: bake in buttered pans. A few raisins would be an
improvement.

POOR MAN’S PUDDING.


Have a pan well buttered; on which put a layer of bread crumbs;
then a layer of apples, pared and sliced, and some sugar and
cinnamon; then bread and butter; then apples, sugar and cinnamon,
till your dish is full. The apples should be juicy: bake, and eat, with
wine sauce.

SAGO PUDDING.
Wash a tea-cup full of sago well, in two waters; then pour over it
one quart of boiling milk; a small piece of butter. Set it on the stove
to simmer, slowly, for a few moments; then take it off. Beat four
eggs very light; add sugar and rose water, to your taste: bake in a
crust, or in a buttered dish.

TAPIOCA PUDDING.
Wash well the tapioca; one cup to a quart of milk; put it on the
stove; let it boil till soft; stir in while hot a little butter; let it get cold;
beat three eggs very light: season to your taste, with sugar and
lemon peel: bake in a paste.

ARROW ROOT PUDDING.


Boil one quart of milk; dissolve one tablespoonful of arrowroot; and
when the milk boils, stir it in as you would starch. Let it cool, and
then mix a half pound of butter, and the same of sugar; add six eggs
beaten very light; the rind of a lemon grated, and some grated
nutmeg; put a paste in your dish, and bake: this quantity will make
four puddings.

ORANGE PUDDING.
Orange pudding is made like lemon pudding: using the oranges
instead of the lemons.

JERSEY RICE PUDDING.


Wash well half a tea-cup full of rice; put it in a bake pan with two
quarts of milk; sugar and cinnamon to your taste: bake in a slow
oven till it is as thick as custard.

SPONGE CAKE PUDDING.


Make a sponge cake batter. Boil it in a pyramid form. Make a sauce
of the white of egg and loaf sugar beaten up together. Pour over the
pyramid.

MUNSEY PUDDING.
Take half a loaf of bread crumbled fine; a cup full of suet chopped
fine; some pippin apples cut in thin slices. Have a tin pan well
buttered; put the bread around it; then put in alternately the apples,
bread and suet, with some sugar and nutmeg; to be baked, and
eaten with wine sauce.

PEACH PUDDING.
One quart of dried peaches. Wash them well in four waters; then
pour three pints of boiling milk on one quart of bread crumbs, made
fine; five large tablespoonsful of flour, three spoonsful of cinnamon,
one wine-glass full of brandy, half a pound of suet, two
tablespoonsful of brown sugar, eight or nine eggs beaten separately:
boil three hours, and eat with wine sauce.

PLUM PUDDING.
Take the crumbs of a five cent loaf of bread; one quart of rich milk
boiled and poured over the bread while hot, one quarter of a pound
of suet cut fine, two pounds of raisins stoned, half a pound of
currants washed and dried, one quarter of citron cut in thin slices,
six eggs beaten very light, one tablespoonful of flour. Mix these
ingredients, and boil, or bake slowly. Make a rich sauce, half wine
and half brandy.

SWEET POTATO PUDDING.


Boil one pound of sweet potatoes till half done; then skin and grate
them; add half of a pound of butter, the same of powdered sugar,
beaten to a cream; add six eggs well beaten, a grated nutmeg, and
lemon peel with a glass of brandy; bake in a paste, and when the
pudding is done, sprinkle the top with sugar, and cover with bits of
citron. Irish potato pudding is made in the same way. A little cream
is an improvement to the Irish potato pudding.
PUMPKIN PUDDING.
Stew a fine sweet pumpkin till soft and dry; rub it through a sieve;
add half a pound of butter beaten to a cream, with half a pound of
sugar, half a pint of new milk, and a wine-glass full of brandy, some
cinnamon, and nutmeg, six eggs beaten very light: put in a paste,
and bake.

LEMON PUDDING.
One pound of butter; the same of sugar beaten to a cream; ten eggs
beaten to a froth, one wine-glass full of brandy and rose water
mixed; the rind of one lemon and the juice; add one tablespoonful of
grated cracker, or Indian meal: bake in a paste.

LEMON PUDDING ANOTHER WAY.


One cup full of sugar, one egg, the rind and juice of one lemon. This
will make one pudding: or mix with a little rice flour, and make two
with two eggs.

A FANCY DISH.
Get some small-sized oranges; take out all the pulp very carefully, by
cutting a round piece out of the top; scrape out the pulp with a
spoon. Make a jelly with the juice of the oranges; wash and wipe dry
the skins of the oranges. Have some blanc-mange of Irish moss: fill
half of the oranges with the blanc-mange, and the rest with the
jelly; let it get perfectly cold, then cut them in halves or quarters,
just as you fancy; pile them in a dish, and ornament with orange or
any kind of long leaves.
MERANG AUX POMME IN PASTE.
Have a good under crust; cover with stewed apples seasoned with
lemon peel; make an icing as for cake; spread thick over the apples:
put it in the oven for a few moments.

MERANG AUX POMME WITH CREAM.


Have some good cooking apples; pare, core, and stew them slowly
till they are tender; then take them out, and fill the centre with any
kind of marmalade. Arrange them in any fanciful manner you may
prefer. Have some apples stewed and mashed fine; fill all the uneven
spaces; cover this with icing, and decorate with blanched almonds,
or macaroon. Set it in a moderate oven for a few minutes: to be
eaten with cream, when perfectly cold.

SPONGE CAKE CUSTARD.


Grate some stale sponge cake; upon which put some thin slices.
Whisk three eggs very light; pour on them one pint of boiling milk:
season with lemon peel and sugar to the taste. Mix all well together:
bake twenty minutes in a slow oven. Cover the top with sponge
cake, and pile the icing up high in the centre.

SWISS CUSTARD.
Take a quart of thick cream. Mix very smoothly eight teaspoonsful of
the finest flour, with some of the quart of cream: season to your
taste with lemon peel and sugar. Then put the remainder of the
cream on the fire, and when it simmers slowly, put in the cream and
flour, stirring it very gently till it is thick; then pour it out: when
perfectly cool, add some lemon juice. Place in a dish some
macaroons, upon which pour some of the custard. And so proceed,
till all of the custard is in. Ornament the top with any kind of
preserves you prefer.

STRAWBERRY WHIPS.
You can make a basket of macaroons any shape you like, by dipping
the edges of the macaroons in barley sugar, and putting them over a
mould. Whip some cream with strawberry juice, fill your basket very
high, and ornament with strawberries and rose leaves.

A GOOD DESSERT.
Take half a pound of loaf sugar; rub on it the rind of a lemon; add
half a pint of boiling water; let it stand till quite cold; beat the whites
of three eggs very light, and one yolk. Mix all together with a little
lemon juice. Put this in a pitcher and set it in a pan of boiling water,
stirring it till it is thick: when quite cold, put it in cups. If you find it
difficult to thicken, add two teaspoonsful of rice flour, with the
boiling water.

APPLE DUMPLINGS.
Boil some potatoes; mash them with salt and a small piece of butter;
add flour, enough to make a paste; pare and core your apples; have
small dumpling-cloths, on each of which place a tablespoonful of
dough, and roll it out; then tie up an apple in each one; scald and
flour your cloth. They should be put in when the water boils, and will
take from half to three quarters of an hour to boil, if the apples are
good.
PEACH DUMPLINGS.
Make a paste of one pound of flour, and a quarter of suet; cut the
suet up fine: put in water enough to make a paste; pare your
peaches, and put each one in a cloth; tie up and boil: have a small
cloth for each dumpling.

FRUIT DUMPLINGS.
Pour some boiling water on flour; beat it very light; roll it on a cloth;
put in your fruit; tie it up, and boil.

INDIAN MEAL FRITTERS.


Make a batter of a pint of milk, some Indian meal, and two eggs;
have ready some hot lard, and fry them.

APPLE FRITTERS.
Make a batter of one pint of milk, and three eggs, and flour; chop
four pippin apples up fine; stir them into the batter; drop in a
spoonful at a time.

PANCAKES.
Make a batter of eggs, and milk, and flour; pour a little in the pan,
sufficient to cover the bottom: when a light brown, turn on the other
side.
A QUICK PUDDING.
Mix one table-spoonful of arrow-root with a pint of milk; beat up two
eggs very light; while the milk is boiling, add the arrow root, and stir
all the time: when it comes to a boil, take it off; let it cool; then add
the eggs, some lemon peel, and a little juice: bake in a paste.

BOILED MILK FRITTERS.


Have a quart of new milk boiling hot; stir into it flour enough to
make a stiff dough: then take it off, and let it get perfectly cold; beat
seven eggs very light, and stir them in: drop them in hot lard, and
fry a light brown.

A BAKED FLOUR PUDDING.


To one quart of milk, add eight tablespoonsful of flour. Stir till the
flour is perfectly well mixed; then add six eggs, beaten separately,
very light: butter your pan, and bake in a quick oven; or bake in
cups; these are then called puffs.

A FARINA PUDDING.
Boil a quart of milk; stir into it four tablespoonsful of farina; let it boil
fifteen minutes: when cold, add a cup of cream, a nutmeg, a cup full
of powdered sugar, and four eggs; bake, and eat hot with wine
sauce.

CORN STARCH PUDDING.


Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like