100% found this document useful (5 votes)
3K views

(Ebook) MATLAB Image Processing Toolbox™ User's Guide by The MathWorks, Inc. 2024 Scribd Download

The document provides access to various MATLAB User's Guides and toolboxes available for download on ebooknice.com. It includes links to guides for image processing, signal processing, econometrics, and more, all published by The MathWorks, Inc. Additionally, it contains information about contacting MathWorks for support and details about the software licensing and trademark information.

Uploaded by

langsabbay9z
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 (5 votes)
3K views

(Ebook) MATLAB Image Processing Toolbox™ User's Guide by The MathWorks, Inc. 2024 Scribd Download

The document provides access to various MATLAB User's Guides and toolboxes available for download on ebooknice.com. It includes links to guides for image processing, signal processing, econometrics, and more, all published by The MathWorks, Inc. Additionally, it contains information about contacting MathWorks for support and details about the software licensing and trademark information.

Uploaded by

langsabbay9z
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/ 65

Download the Full Ebook and Access More Features - ebooknice.

com

(Ebook) MATLAB Image Processing Toolbox™ User's


Guide by The MathWorks, Inc.

https://ebooknice.com/product/matlab-image-processing-
toolboxtm-user-s-guide-11236248

OR CLICK HERE

DOWLOAD EBOOK

Download more ebook instantly today at https://ebooknice.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

(Ebook) MATLAB Signal Processing Toolbox™ User's Guide by The MathWorks, Inc.

https://ebooknice.com/product/matlab-signal-processing-toolboxtm-user-s-
guide-11236258

ebooknice.com

(Ebook) MATLAB Econometrics Toolbox™ User's Guide by The MathWorks, Inc.

https://ebooknice.com/product/matlab-econometrics-toolboxtm-user-s-
guide-11236174

ebooknice.com

(Ebook) MATLAB Bioinformatics Toolbox™ User's Guide by The MathWorks, Inc.

https://ebooknice.com/product/matlab-bioinformatics-toolboxtm-user-s-
guide-11236232

ebooknice.com

(Ebook) MATLAB Mapping Toolbox™ User's Guide by The MathWorks, Inc.

https://ebooknice.com/product/matlab-mapping-toolboxtm-user-s-guide-11236250

ebooknice.com
(Ebook) MATLAB Optimization Toolbox™ User's Guide by The MathWorks, Inc.

https://ebooknice.com/product/matlab-optimization-toolboxtm-user-s-
guide-11236252

ebooknice.com

(Ebook) Deep Learning Toolbox Getting Started Guide - MATLAB by The MathWorks, Inc.

https://ebooknice.com/product/deep-learning-toolbox-getting-started-guide-
matlab-43710832

ebooknice.com

(Ebook) MATLAB Computer Vision Toolbox™ User's Guide by The MathWorks, Inc.

https://ebooknice.com/product/matlab-computer-vision-toolboxtm-user-s-
guide-11236240

ebooknice.com

(Ebook) MATLAB Curve Fitting Toolbox™ User's Guide by The MathWorks, Inc.

https://ebooknice.com/product/matlab-curve-fitting-toolboxtm-user-s-
guide-11236242

ebooknice.com

(Ebook) MATLAB Fuzzy Logic Toolbox™ User's Guide by The MathWorks, Inc.

https://ebooknice.com/product/matlab-fuzzy-logic-toolboxtm-user-s-guide-11236244

ebooknice.com
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
Basic Image Import, Processing, and Export

Basic Image Import, Processing, and Export


This example shows how to read an image into the workspace, adjust the contrast in the image, and
then write the adjusted image to a file.

Step 1: Read and Display an Image

Read an image into the workspace, using the imread command. The example reads one of the
sample images included with the toolbox, an image of a young girl in a file named pout.tif , and
stores it in an array named I . imread infers from the file that the graphics file format is Tagged
Image File Format (TIFF).

I = imread('pout.tif');

Display the image, using the imshow function. You can also view an image in the Image Viewer app.
The imtool function opens the Image Viewer app which presents an integrated environment for
displaying images and performing some common image processing tasks. The Image Viewer app
provides all the image display capabilities of imshow but also provides access to several other tools
for navigating and exploring images, such as scroll bars, the Pixel Region tool, Image Information
tool, and the Contrast Adjustment tool.

imshow(I)

Step 2: Check How the Image Appears in the Workspace

Check how the imread function stores the image data in the workspace, using the whos command.
You can also check the variable in the Workspace Browser. The imread function returns the image
data in the variable I , which is a 291-by-240 element array of uint8 data.

1-5
1 Getting Started

whos I

Name Size Bytes Class Attributes

I 291x240 69840 uint8

Step 3: Improve Image Contrast

View the distribution of image pixel intensities. The image pout.tif is a somewhat low contrast
image. To see the distribution of intensities in the image, create a histogram by calling the imhist
function. (Precede the call to imhist with the figure command so that the histogram does not
overwrite the display of the image I in the current figure window.) Notice how the histogram
indicates that the intensity range of the image is rather narrow. The range does not cover the
potential range of [0, 255], and is missing the high and low values that would result in good contrast.

figure
imhist(I)

Improve the contrast in an image, using the histeq function. Histogram equalization spreads the
intensity values over the full range of the image. Display the image. (The toolbox includes several
other functions that perform contrast adjustment, including imadjust and adapthisteq, and
interactive tools such as the Adjust Contrast tool, available in the Image Viewer.)

I2 = histeq(I);
figure
imshow(I2)

1-6
Basic Image Import, Processing, and Export

Call the imhist function again to create a histogram of the equalized image I2 . If you compare the
two histograms, you can see that the histogram of I2 is more spread out over the entire range than
the histogram of I .

figure
imhist(I2)

1-7
Discovering Diverse Content Through
Random Scribd Documents
The words in the despatch, crumpled fiercely and thrust into
Gregory’s pocket, were these:—
“My son will be the bearer of the funds required. Trust you will give him the
opportunity he desires for study of social problems.
“Ingraham.”

It was the first word of reply to his letter which Gregory had
received, and it was a word which made him set hard his teeth and
groan like a wounded lion.
“Perhaps it is fair,” he said to himself, as he crossed the bridge;
“but Ingraham’s Nemesis as the price is a higher one than even I
expected.”
Above, in the mill hall, Oliver was mingling with the people who
were in the habit of remaining together for an hour of social
interchange after the programme, on these occasions. He quickly
found his old townsman, Mr. Hanson, who seemed more amazed
than rejoiced to greet him in Fraternia.
“Stopped over, eh, to see our village?” he asked. “On your way
North, I suppose?”
“Oh, no,” said Oliver, smiling complacently; “I have come straight
from home. I have a commission for your czar from my father, and I
rather look to throwing in my fortunes with you folks. I want to see
how this experiment works; study it, you know, on all sides. If I like
it, I guess I shall stay.”
“Oh, really,” said Hanson, a little aghast.
“How are you getting on, anyway?” proceeded Oliver, craftily.
“Rose-colour washed off yet? Has it been pretty idyllic this winter?
Say, I should think catering for a crowd up in this valley would be
quite a job. Don’t get salads and ices every day, I take it.”
Hanson shook his head impatiently, longing to get away from the
questioner.
“Well,” said Oliver, “I suppose by this time Gregory the Great has
issued his edicts and made all the poor people rich, hasn’t he? and
all the rich people poor? That seems to be the method of evening
up. I don’t wonder the poor fellows like it. Should think they would.”
“You will know better about us when you have been here awhile,
Mr. Ingraham.”
Oliver nodded cheerfully. “Oh, yes, of course. I am going to take
notes, you see. Perhaps I’ll write it up by and by,” and he tapped the
neat note-book which protruded from a pocket of his coat. “Are all
the sinners saints by this time?” he added.
“Hardly.”
“Well, then, we’ll put it the other way,” said Oliver, with a peculiar
significance in his high voice, “are the saints all sinners yet?” The
malicious leer with which this question was accompanied seemed to
turn it into a hateful insinuation, which Hanson, with all his half-
suppressed discontent, resented hotly. He was about to make a
hasty reply when Gregory came up and spoke to Oliver, to whom he
held out his hand. His manner was as cold as could be with decent
courtesy, and when Oliver had shaken his hand he passed his
handkerchief over it with the impulse a man has after touching a
slug or a snake.
Oliver noticed the gesture, and rubbed his long white hands
together reflectively.
CHAPTER XXXIV
Look in my face; my name is Might-have-been;
I am also called No-more, Too-late, Farewell;
Unto thine ear I hold the dead sea-shell
Cast up thy Life’s foam-fretted feet between;
Unto thine eyes the glass where that is seen
Which had Life’s form and Love’s, but by my spell
Is now a shaken shadow intolerable,
Of ultimate things unuttered, the frail screen.
Mark me, how still I am!
—D. G. Rossetti.

It was mid-April and the afternoon of a day of perfect weather, of


summer rather than spring.
The hills around Fraternia were covered now in sheets of flame-
colour, white and rose, from the blossoming of the wild azalea and
laurel. The air was laden with perfume and flooded with sunshine.
It was at the close of the afternoon school when Anna, a company
of the children with her, started to climb the eastern hill which rose a
little beyond the mill pond, to gather flowers.
Gregory, from the open window of his office in the mill, watched
the pretty troop as they threaded their way up the steep path and
were soon lost to sight in the woods. He heard them speak of Eagle
Rock as the goal of their expedition,—a favourite point of view, less
than a mile to walk, and nearly on the crest of the hills.
Anna was dressed in the coarse white cotton of Fraternia
manufacture which was the usual dress of the girls and women of
the village in the house and out in dry, warm weather, simply made,
easily laundered, cleanly, and becoming. Her tall figure, the last to
disappear up the woodland path, had attracted the eyes of another,
as well as of John Gregory.
Oliver Ingraham, in these two months grown an all-too-familiar
figure in Fraternia, finding his way stealthily and untiringly to every
favourite nook and corner of the valley, had also watched the start
from some lurking-place. It was half an hour later when Gregory
noticed him sauntering casually along the foot of the hill, and with
an air of indifference striking into the same path which Anna and the
children had taken. Gregory watched him a moment fixedly, his
eyebrows knit together, and he bit his lip with impatience and
disgust. Of late Oliver had shown an ominous propensity to haunt
Anna, whose dislike of his presence amounted well-nigh to terror.
More than once Gregory’s watchful eyes, which never left Oliver’s
movements long unnoted, had observed attempts on his part to
follow or to overtake her, to seek her out and attach himself to her.
Invariably Oliver found himself foiled in these attempts, although he
had no means of attributing the interference to Gregory. Thus far the
intervention had been accomplished almost unnoticeably, but none
the less effectively.
The afternoon was a busy one for Gregory. The mill, no longer
silent and deserted, was running now on full time; and, to the great
satisfaction of a majority of the colonists, Gregory had withdrawn his
scruples against selling the products of their manufacture at a
reasonable profit. He was finding it easier and easier to compromise
with his initial scruples. It had also become more imperative to try to
meet, in so far as was reasonable, the demands of the people, since
already Fraternia had suffered serious defections. A number of
substantial families had withdrawn earlier in the spring, among them
the Hansons and the Taylors, who had taken the pretty Fräulein
Frieda with them, to Anna’s great regret. Others talked of leaving,
and, in spite of the greater financial easiness, criticism and jealousy
were at work in the little company at first so united. The almost
insuperable difficulties attending the experiment had now fully
declared themselves.
However, there was plenty of work to do, which was a material
relief. Gregory glanced now at the pile of papers before him on his
desk, and then once more through the window at the figure of
Oliver, receding up the hill. No, he could not run the risk of allowing
him to overtake and annoy Anna. The work must wait. Taking his
hat, he left the mill hastily; but, instead of choosing the path behind
Oliver, Gregory turned and went up the valley a little distance, struck
through behind the houses, crossed a bit of boggy ground which lay
at the foot of the hill in this part of the valley, and so mounted the
hill below Eagle Rock in a line to intercept Oliver before he could
overtake Anna, if such were his purpose.
There was no path up this side of the hill, but Gregory found no
trouble in striding through the deep underbrush which would have
swamped the women and children completely. Soon he reached a
point from which he commanded a sight of Eagle Rock, and a glance
showed him the fluttering dresses of the children already on its
summit. In another moment he dashed up on a sharp climb, for the
hill was very steep at this point, and reached the path only a short
distance from the base of the rock. He looked up, but no one was in
sight; then down the path, and in a moment Oliver came into view
walking much more rapidly than fifteen minutes before, when he
had entered the woods. He slackened his pace as he caught sight of
Gregory slowly approaching down the path, and sought to hide a
very evident discomfiture with his evil smile.
“You got up here in pretty good time, didn’t you, Mr. Gregory?” he
asked, as he reached him. “I saw you, seems to me, in your office
when I came along. I’ve taken my time, you see. A beautiful day for
a walk.”
Oliver’s small green-grey eyes twinkled wickedly as he spoke these
apparently harmless words, for he saw, or felt, that beneath every
one of them Gregory’s anger, roused at last, reached a higher pitch.
Oliver perfectly understood what he was here for.
“I have a word to say to you,” said Gregory, stormily. “You will
have to stop haunting the women and children, and annoying them
with your attentions. I speak perfectly plainly, Mr. Ingraham; they
are not agreeable and they must be stopped.”
“You rule with a rod of iron here, Gregory,” said Oliver, his long
fingers twining together; “what you say goes. Still, you know, you
might go a little too far.”
Gregory did not reply, but stood watching him as a lion might
watch a reptile.
“I am willing to stay in Fraternia, under favourable conditions,”
Oliver proceeded, with hideous cunning; “but I should think, as I am
paying pretty well for my accommodations, I ought, at least, to get
the liberty of the grounds. What do you say?”
“I say, Go, this minute, or I’ll throw you neck and crop down that
bank,” said Gregory, with unmistakable sincerity, at which Oliver,
suddenly cowed, and his weak legs trembling under him, faced
about promptly and retreated down the path. He paused at a safe
distance, while Gregory’s hands tingled to collar him, and called
back, in a loud, confidential whisper:—
“You can have her all to yourself this time. That’s all right,” and
with this he hurried off, his thin lips writhing in a malicious smile,
and his hands clenched tightly and cruelly.
For a moment Gregory stood still in the path. A dark flush had
mounted slowly even to his forehead. He was irresolute whether to
follow and find Anna, or to return directly to the valley. Something in
Oliver’s ugly taunt acted like a challenge upon him, it seemed, for,
turning, and catching through the trees the glimmer of Anna’s white
dress, he hastened on up the path.
He found her sitting on a mossy rock at the foot of the cliff, where
there were trees and shade and a fair view of the valley, and the
blue billowing sea of the mountain ranges beyond. Her strength and
colour had returned with the out-door life of the spring, and she
looked to-day the embodiment of radiant health. Greatly astonished
at Gregory’s appearance, she yet welcomed it with unaffected
gladness, starting to rise from her low seat with the impulses of
social observance which she could not quite outgrow even in the
wilderness; but he motioned to her to sit still. All around her the
children had flung their branches of laurel and azalea, running off to
gather more and bring her, and the delicate suffusion of colour made
an exquisite background to the picture. The picture itself, Gregory
thought, Everett ought to have painted for a Madonna; for in Anna’s
lap leaned a sturdy, fair-haired boy, with a cherub face, a child of
less than four years, his head thrust back against her shoulder as he
looked out from that vantage ground with serene eyes at Gregory,
while Anna held one round little hand in hers and looked down upon
the child with all the wistful fondness of unfulfilled maternal love.
“Do not smile,” said Gregory, with affected sternness at last, as
she glanced up from the child to him with a questioning smile,
expecting some explanation for his presence here; “I have come this
time to scold you.”
“O dear!” said Anna, with a gay little laugh of surprise. “My turn
has come!”
“Yes, your turn has come,” he continued gravely. “Do you not
know that when you come away on such long, lonely climbs as this,
even with the children, you give us anxiety for you, and trouble? I
have had to come all this distance to take care of you.”
Anna shook her head, much more puzzled than penitent.
“What is there to be troubled about?” she cried.
Gregory did not answer at once. He found it impossible to make
mention of Oliver in her presence. He fixed his eyes on the little
child, who was on his knees now, by Anna’s side, pouring out into
her white dress a small handful of scarlet berries, and letting them
run like jewels through his fingers, laughing to see them roll.
“Do you not know,” he began again, very slowly, “that we fear for
your strength, for your endurance, upon which you will never,
yourself, have mercy?”
Anna began to protest a little, her colour deepening at some
vague change in his tone and manner.
“Do you not know,” he continued, not heeding her interruption,
“that you are the very heart of our life, here in Fraternia? that we all
turn to you for our inspiration, our hope, our ideal? Should we not
guard you, since without you we all should fade and fail?”
Never before had Anna heard this cadence of tenderness in
Gregory’s voice, nor in the voice of man or woman; the whole
strength of his protecting manhood, of his high reverence and his
strong heart, was in it, but there was something more. What was it?
A tremor ran through Anna’s heart. Could she dare to know? She
lifted her eyes at last to meet his look, and what she read was what
she had never dreamed of, never feared nor hoped—the supreme
human love which a man can know. Reading this, she did not fear
nor faint nor draw her own look away, but rather her eyes met his,
full of awe and solemn joy; for at last, in that moment, her own
heart was revealed to itself.
“O Anna!—O Benigna!”
Gregory spoke at last, or rather it seemed as if the whole deep
heart of the man breathed out its life on the syllables of those two
names.
In the silence which followed Anna sat quite quiet in her place, the
sun and the soft shadows of the young oak leaves playing over her
face and figure. The child still tossed his red berries with ripples of
gleeful laughter over the whiteness of her dress, and not far away
could be heard the busy voices of the older children as they
ruthlessly broke away the blossoms from their stems. And in the sun
and shade and the stillness Anna sat, while wave after wave of
incredible joy broke over her spirit. For the first time in her life she
knew love, knowing it for what it was. She had not asked to know it,
nor mourned that she had missed its full measure, nor dreamed that
it could yet be hers; but it had come, not stayed by bonds nor
stopped by vows. It was here! The man whose strong spirit, in its
freedom and power, had cast its spell upon her mysteriously even
before she had seen his face save in a dream, loved her, with eyes to
look like that upon her and that mighty tenderness! Life was fulfilled.
Let death come now. It was enough!
The moment, being supreme in its way, was not one to leave
room for outward excitement, for flutter and trepidation. Anna rose
now from her place with perfect calmness, and bent to take the
little, laughing child by the hand, while she went to call the others
together. Gregory had turned away slightly, and with his arms
crossed over his breast was leaning hard against the rugged wall of
the cliff, his head thrown back against it, his face set, his whole
aspect as of some granite figure of heroic mould, carved there in
relief. Anna heard a sound like a groan break from his lips, and
turning back, with an irresistible impulse, laid her hand, light as a
leaf, upon his arm.
From head to foot Gregory trembled then.
“Don’t,” he said sternly, under his breath.
“What is it?” asked Anna, confused at his sudden harshness.
“It is the end,” he said, with low distinctness and the emphasis of
finality.
Then, only then, did Anna waken to perceive that what in that
brief moment of joy she had taken for glory, was only shame and
loss and undoing, unless smothered at the birth.
An inarticulate cry broke from her then, so poignant, although low,
that the little child, pulling at her dress, began to cry piteously. She
stooped to comfort him, gave him again the hand which she had laid
on Gregory’s arm, then, turning, walked slowly away.
Gregory made no motion to detain her or to follow, but stood as
she left him, braced against the rock. Anna gathered her little flock,
and they hastened down the hill in a gay procession, with the
waving branches of April bloom, and the merry voices of the
children. Only Sister Benigna, as she walked among them, little
Judith noticed, was white and still.
CHAPTER XXXV
Then fell thick rain, plume droopt and mantle clung,
And pettish cries awoke, and the wan day
Went glooming down in wet and weariness;
But under her black brows a swarthy one
Laugh’d shrilly, crying: “Praise the patient saints,
Our one white day of Innocence hath past,
Though somewhat draggled at the skirt. So be it.”
—Tennyson.

At nine o’clock that evening Barnabas Rosenblatt, working around


the mill stables, was startled at the sudden appearance of Gregory,
who passed him without speaking, as he went hurriedly into the stall
and brought out his horse. The day had been followed by a night of
brilliant moonlight, and Barnabas saw, as distinctly as if it had been
day, that his face, usually firm and composed, was drawn and
haggard to a degree. He started to speak to him, but an imperious
gesture of Gregory silenced him. Without a word Barnabas therefore
assisted him in saddling the horse, and then stood perplexed as he
watched him gallop away down the valley in the moonlight.
Straight on through a narrow bridle-path which led by a short cut
through the stretch of oak wood to the little hamlet of Spalding,
Gregory galloped. He had reached the outskirts of the woods, and
was in sight of the level meadows and the cluster of lights of the
village beyond, when he suddenly perceived the figure of a man on
foot approaching him from the direction of Spalding. A few steps
more, and Gregory saw, with surprise and strange perturbation, that
it was Keith Burgess. He reined up his horse and stood motionless,
until Keith had reached him, and called out a greeting as he stood in
the path, looking a pigmy beside the Titanic proportions of the horse
and rider. The moonlight showed Keith more thin and wan than ever.
He had returned to Fraternia once before this spring, in March, but,
after a week, had been glad to go back to Baltimore, with some
rather vague commission. His return at this time was wholly
unexpected, even by Anna.
Keith had long since come to stand to Gregory for something like
a concrete embodiment of his many disappointments and vexations,
by reason of his lukewarm participation in his own purposes, his
ineffective labours, and his continual draft upon Anna’s sympathies.
As Gregory looked down upon him, thrown at this moment so
unexpectedly in his path, a singular hardness toward the man came
upon him, for he was hard beset by passion; and while he meant to
have no mercy upon himself, he was not in the mood to have mercy
upon another man, least of all, perhaps, upon Keith.
“You are going back to Fraternia?” he asked coldly, his tone
striking Keith with chill surprise. The latter assented as a matter of
course.
There was a moment of silence; Keith felt something sinister in
the nature of it.
“Why should you go back there?” Gregory asked now, with the
same careless coldness; “you have no heart in Fraternia or its
purposes.”
Keith was stirred, and answered pointedly:—
“I have at least a wife in Fraternia, Mr. Gregory.”
Gregory looked at him a moment with a measuring glance, noting
his wasted and feeble appearance.
“I suppose you do need nursing,” he said slowly.
Keith Burgess turned ashy pale. Was this wanton injury? Did
Gregory wish to insult him? What did it mean? Gregory did not know
himself. He knew only that, in the agony of that night, for he had
fully resolved himself to see Anna no more, the sight of Keith
Burgess worked like madness in his brain.
“Mrs. Burgess,” he said now, with the deliberation of strongly
suppressed excitement, “is more highly endowed for great issues
than any person I have ever known. It is almost a pity that she
should not have freedom to use her powers in the greater activities
to which she is fitted.”
Each sentence, cruel with all the cruelty which the climax of pride
and passion could inspire, pierced the heart of Keith like a shaft
barbed with steel. He stepped backward and leaned against a tree,
breathing hard. The occult, mysterious quality of the moment’s
experience to him was that he saw himself, distinctly and as if by an
inexorable necessity, turning away from Fraternia, and going back by
the way which he had come.
Without another word, Gregory tightened his rein and galloped on,
out through the wood’s edge and so down to the plain. He did not
see, in the high excitement of the moment, the figure of a man
lurking stealthily among the trees at no great distance from where
Keith stood. When the sound of the horse’s hoofs had died away,
this figure stepped softly out from its shelter and passed along the
bridle-path, peering inquisitively in the face of Keith as he still stood
where Gregory had left him. But neither did Keith observe him, nor
care who he was, and so he went on his way toward Fraternia. He
looked back once or twice. His last look showed him that Keith had
gathered himself together and was walking slowly away, in the
direction from which he had come.
Keith walked blindly on, not knowing why he went, nor where he
went, like a man who has suffered a heavy blow upon his brain, and
moves only automatically without thought or will. On the outskirts of
the village, near the railroad, he passed a barn, rickety and disused,
but there was old hay in a heap on the floor of it, it offered shelter,
and shelter without the contact with others from which he shrunk as
if he were in disgrace, and fleeing for his life. Accordingly Keith went
into this place, drawing the broken door together as far as he could
move it on its rusty hinges, threw himself on the heap of hay, and
slept until five o’clock in the morning. The one passenger train of the
day passing through Spalding eastward was due at five o’clock. Keith
was wakened by the long whistle announcing its approach, and
came dizzily out into the chill and wet of a miserable morning.
The train slowed down as it neared the place where he stood. He
swung himself upon it with the brief but tense nervous energy of
great exhaustion, sank into a vacant seat in the foul, unventilated
car, and was carried on, whither he did not know or care.
Anna, coming back from the walk to Eagle Rock, had gone to her
own house alone. Here she spent the earlier hours of the evening in
the deepest travail of soul she had ever known. The purity and
unworldliness of all her life, both the life of her girlhood and that
with Keith, had served to keep far from her familiarity with
possibilities of moral danger. She was as innocent of certain kinds of
evil as a child, and the thought that a temptation to a guilty love
could assault her would, until this day, have appeared to her
incredible. And now, in the fierce struggle of this passion, the only
one she had ever known, she knew herself not only capable of sin,
but caught at last in its power.
Not that for a moment she dreamed of any compromise of
outward fidelity; such a thought she rejected with horror as
inconceivable either to herself or to Gregory, whom she firmly
believed to be far stronger than she. But the flaw in faithfulness had
come already, beyond recall, beyond repair. Her whole soul moved
toward this man, who had so long secretly dominated her inner life,
with a mighty and overwhelming tide.
Her relation to Keith had been that of gentlest consideration,
kindliness, and affection. More it had never been; and to-night it
seemed as powerless to stay the flood of passion as a wall of sand
built on the shore of an infinite sea by the hands of a child.
So Anna thought, so she felt. She went to the door of her cabin
with this thought mastering her, driven by restlessness, and longing
to feel the coolness of the night air on her face. For a moment she
stood in her open door, and saw mechanically that the moonlight
was shed abroad in the valley; she heard the voices of the men
across the river singing in a strong, sweet chorus.
Then, suddenly, as if the words had been spoken in her ear, the
thought came to her, “But Keith needs me; he needs me now!”
What was it? She did not know. She never understood. The sense
was strong upon her that Keith was near her; that he was in some
danger, and needed her.
Without pause to consider what she did, Anna flew down the river
path and reached the mill breathless. The pond lay in the moonlight,
motionless. The air did not stir. The mill was still and dark and
deserted. The woods were dim with their night mystery. She looked
down the valley, and up, and across the river, and everywhere was
perfect peace, save in her own heart. Then in the silence she heard
a step approaching from the direction of the woods below. She drew
back hastily into the protection of the mill porch and waited for the
steps to pass. Whoever it was paused for a little time above the mill,
and Anna’s heart beat hard with a sense of dread and danger. Finally
she heard the steps pass on, and when she returned to the road she
recognized the unmistakable figure of the man now moving on in the
unshadowed moonlight to the bridge above. It was Oliver Ingraham.
Slowly Anna returned to her own cottage, not daring to do
otherwise, a heavy oppression on her heart.
Early in the morning, which was cold and rainy, Oliver was at her
door, and she answered his summons herself, full of a vague,
trembling anxiety. He scanned her face narrowly; it was careworn
and hollow-eyed, for she had slept not at all.
In silence he handed her a letter, broken at the edges, and soiled
with long carrying about. She glanced at the address. It was Keith’s,
written by herself perhaps a month before; not a recent letter. She
looked at Oliver in speechless perplexity.
“I found that lying on the ground down near Spalding last night,”
he said, still eying her craftily, and with that hurried off, giving her
not another word.
Anna went in, closed the door, and drew out the letter. It was
unimportant, insignificant, simply an ordinary letter of wifely
affection and solicitude, but one which had evidently been much
read, being worn on the folds. Who could have carried it save Keith
himself? Had he, then, been really near her the night before? Was
he really coming?
Anna knew already that it was for this she longed supremely.
Noon brought to Everett a special messenger with a letter from
Gregory, who brought with him also the roan horse ridden the night
before to the county town, C——, and evidently ridden fiercely. At C
—— was the bank where Gregory transacted all his business. This
letter stated, first of all, that he had suddenly reached the conclusion
that it was important and imperative that he should go at once to
England in the interests of the colony. He should not return to
Fraternia before sailing. He wished to empower Everett to act in his
place during his absence, which would not be for more than three
months.
Various items of business were enumerated, and the letter closed
with this remarkable statement: “The funds furnished by Mr.
Ingraham of Burlington have been returned to him with the
exception of the five thousand dollars already used, which I shall
restore at my earliest opportunity. This removes the obligation from
us of counting Mr. Oliver Ingraham as one of our number, and I beg
that you will signify to him my conviction that his continued presence
in Fraternia is impossible. Do not allow him to stay a day if you can
help yourself, and keep him under your eye while he remains.”
CHAPTER XXXVI
I said farewell;
I stepped across the cracking earth and knew
’Twould yawn behind me. I must walk right on,
... Fate has carried me
’Mid the thick arrows; I will keep my stand,
Not shrink and let the shaft pass by my breast
To pierce another: oh, ’tis written large
The thing I have to do.
—George Eliot.

The following morning Anna sent for Oliver. Word had reached her
that he was about to leave Fraternia. In the depth of her present
distress and perplexity a thought which “had no form, a suffering
which had no tongue” had arisen. Gregory, she knew, had left the
village hastily that night under stress of powerful emotion, perhaps
in a condition of mental excitement exceeding his own control. It
seemed to her possible that somewhere on the way from Fraternia
to Spalding he might have encountered Keith. The letter brought by
Oliver indicated, she was more and more convinced, that he had
really been on his way to her. If this were true, some event had
interposed, something had occurred to hinder his coming. What
could it have been, supposing him to have been but two miles away,
save some mysterious, unthinkable effect of an interview with
Gregory, if such there had been? It was no longer possible, no
longer justifiable, to await events. She must herself discover all that
Oliver knew, even if the discovery were to mean despair.
Alone, in her own cabin, she received Oliver. If Keith had been in
Fraternia, or John Gregory, it would not have been permitted; but
her intense anxiety and suspense overbore her usual shrinking from
contact with the man, and Everett yielded to her wish to see him
alone.
Oliver entered the cabin, noting its simple appointments with his
characteristic curiosity. Anna pointed to a chair which he took,
although she herself remained standing. Her face was as white as
her dress, her eyes deeply sunken, her manner sternly imperious.
“You are going away from Fraternia to-day?” she asked, with swift
directness.
“Yes,” said Oliver, nodding with his peculiar smile; “this precious
demigod or demagogue—whichever you please—of yours, your
imperial Gregory, has issued a ukase against me, in short, has done
me the honour to banish me from the matchless delights and
privileges of Fraternia!” The last word was spoken with a slow
emphasis of condensed contempt.
“There is something really a little queer about it,” Oliver continued,
in a different tone. “I am on to most of what happened between my
father and Gregory, but I’ve missed a link now somewhere. You see,
the governor, in a fit of temporary aberration, offered Gregory a
magnificent contribution for his socialist scheme down here; but
Gregory was pretty high and lofty just then, and, ‘No, sir,’ said he—I
heard him, though he and the governor don’t know it—‘No, sir, I
couldn’t touch your money. I am just that fastidious.’ The governor
had been confessing his sins to Gregory, the worse fool he! It
seemed that his money had come to him in a way that might make
some men squeamish, and Gregory, oh, dear, no! he wouldn’t have
touched those ill-gotten gains as he was feeling then—not with the
tip of one finger.
“But the joke is,” Oliver went on, “that he had to come to it. Oh,
yes; he got down on his marrow bones to the governor here about
three months ago, and wrote to him that he had reconsidered the
matter, and saw his mistake,” and Oliver gave a low chuckle; “so the
governor had to come down with the lucre, more or less filthy as it
was, and I don’t think he was quite so much in the mood for it either
as he was at the first, to tell the truth. But he sent it all the same,
and sent me with it, don’t you see? I came as the saviour of
Fraternia, although I have never been so recognized. The whole
town has been run the last month or two on Ingraham money, and it
seems to have greased the wheels about as well as any other
money, for all I see. But now comes the unexpected! Off goes
Gregory to England, sends back the governor’s check, so I hear from
Everett, and kindly writes me to take myself off. What brought him
to that is what I don’t quite see through yet.”
“I have no doubt,” said Anna, concealing her dismay at Oliver’s
malign disclosure with a manner of cold indifference, “that Mr.
Gregory had good reasons for thinking it better for you to return to
Burlington.”
“You’re right there,” retorted Oliver, quickly; “oh, yes, he had
excellent reasons, the best of reasons. A man who knows too much
is often inconvenient, you know.”
“Mr. Ingraham,” Anna asked hastily, apparently ignoring this
insinuation although she trembled now from head to foot, “I am not
interested in the business relations of your father and Mr. Gregory. It
was not to hear of them I sent for you. You brought me a letter
yesterday which I think must have been not long ago in my
husband’s possession. I wish you to tell me if, on the night when you
found this letter, that is the night before last, you saw my husband in
the neighbourhood of Fraternia?”
“Oh, yes,” replied Oliver, as if it were quite a matter of course;
“were you not expecting him?”
“Where did you see him?” The question came quick and sharp.
“Well,” said Oliver, reflectively, “you would like me to be exact, I
suppose. Let me see, how shall I describe the place so that you will
recall it—distinctly.”
There was a certain cold deliberation in the articulation of these
words which gave them a sickening cruelty. They called up strange
visions of dread and dismay to Anna’s tortured imagination.
“Speak more quickly,” she commanded, rather than asked, “the
precise spot makes no difference.”
“It was near the edge of the woods, on the Spalding side, that I
saw him first. The night was quite bright with moonlight, if you
remember. I had taken a stroll down to Spalding myself for some of
those little luxuries which Fraternia doesn’t furnish, and was on my
way back when I first noticed Mr. Burgess. He was just striking into
the path, there by that dead oak tree; you may remember it. I
noticed it because it stood out so white in the moonlight, and it was
just at the foot of it that I picked up that letter. I did not know that
he had dropped it, nor whose it was until after I got home.”
“Undoubtedly false,” thought Anna; “you had not had the chance
to read it, that was all,” but she did not speak. Oliver too was silent,
as if he had answered her question, and was done.
“Please go on.” Anna kept her patience and control still.
“Oh!” exclaimed Oliver, as if surprised, “you want to hear more, do
you? All right. I guess likely I’m the only man that can tell you, being
the only witness, in fact.”
“Witness of what?” Anna cried importunately.
“Well, that’s it. That’s what I’ve asked myself more than once
since that night, and I rather guess as good a description as I could
give would be to call it a kind of moral murder; a moral murder,” and
Oliver repeated the phrase as if gratified by the acuteness of his
perception in forming it.
He watched her face closely, and beginning to fear from the bluish
shade which tinged her pallor that Anna would soon be released
from his power to torture by unconsciousness, hastily took another
line.
“Oh, you’ve nothing to worry about, Mrs. Burgess, nothing at all.
That was just a little fancy of mine, just my metaphorical way of
stating things. It was a very simple little incident, nothing which
need affect a man unpleasantly in the least. It just happened, you
see, that Gregory was galloping down the path toward Spalding, and
he met your husband, and they had a little talk together,—a mere
quiet conversation for a few moments,—and Mr. Burgess seemed to
change his mind about going to Fraternia just then, and turned back
toward the village. That was all. I watched him a little, to be sure he
didn’t need any help, you know, afterward. Gregory galloped right
along; he was going to catch a train, I suppose, at C——, and that
made him in something of a hurry, of course.”
“Why should my husband have needed help, Mr. Ingraham? Will
you be good enough to explain yourself clearly, and in as few words
as possible?” Anna spoke more calmly now, but her eyes were like
coals of fire.
“Certainly, certainly. I cannot repeat Gregory’s language, not
literally, but it seemed to cut Mr. Burgess up a good deal at the time,
—at least I fancied so. That is what I meant by that little simile of
mine awhile ago. He’s all over it now, of course. It was only a few
words anyway. Just that Gregory said, in that short way he has once
in awhile—Probably you’ve never heard him; he wouldn’t be apt to
speak so to you,” and Oliver decorated the sentence with one of his
most insinuating smiles.
“Mr. Gregory said—?” Anna asked, looking into his face with an
unflinching directness, before which Oliver’s eyes wandered
nervously.
“Why, he seemed surprised that Mr. Burgess should be coming
back so soon, and he gave him to understand that a man like him,
who was sick all the time, and not much of a Fraternian, either, was
rather a drag on such a woman as you, don’t you see? and it might
be fully as well if he should keep away and give you your freedom
most of the time.”
“Did my husband make any reply that you heard?” asked Anna,
huskily, this hideous distortion of unformulated traitor thoughts
which had lurked in the background of her own consciousness
confronting her now to her terror, and her heart doubly sick with the
loathing of being forced to ask such information from such a source.
“He said you were at least his wife, I remember that. I guess that
was about all. It struck me at the time that there was something in
what he said, with all due respect for Gregory. He rules everything
here, of course, though, I suppose,—even to the relations between
husbands and wives.”
The last words were lost upon Anna.
“You may go now, if you please, Mr. Ingraham,” she said calmly.
Her look and an unconscious gesture of dismissal were imperative,
and Oliver, not daring to disobey, left the place without another
word.
For two days Anna sat alone and in silence, waiting for the
summons which she knew by a sure intuition must come.
Oliver’s story had been confirmed in so far that it had been
learned that Keith had been seen in Spalding on the night of
Gregory’s departure, and had been known to take an east-bound
train on the following morning. Nothing further was discovered
regarding his movements, and it was useless to try to follow and find
him. Anna could only wait.
When the message came it was, as she had known it would be,
urgent and ominous. Keith was in Raleigh; he was very ill; she must
go at once.
Everything was ready, and with a strange composure and
quietness as of one carrying out a line of action fully foreseen, Anna
went on her journey, so like and yet so unlike that other journey to
Keith which she had taken in her girlhood, ten years before. That
had ended in their marriage. How would this end?
Reaching the city in the afternoon, Anna was driven with the haste
she demanded to the address named in the message which had
come, not from Keith himself, but from a physician. It was not that
of a hotel, as she had expected, but of a boarding-house of very
moderate pretensions in a quiet street. Even the small details of the
place, in their cheap commonness, smote her heart. Was it in places
like this that Keith had, after all, been living, instead of in the well-
appointed hotels in which she had always fancied him?
The landlady, a kindly, careworn woman, plain of dress and of
speech, received Anna with a mournful face, but forebore
explanations, seeing that it was time rather for silence, and led her
down a long corridor to the door of a dim and silent room.
There was a little stir as Anna stood in the open door; the
physician came out and spoke to her, and she saw a nurse sitting
quietly by a window. But Anna did not know that she saw or heard
them; her sense took in only her husband, with eyes closed and the
shadow of death upon his face, lying upon the strange bed in this
place of strangers.
She was by his side and his hands were in hers, when presently
he opened his eyes. Seeing her, a sudden light of clear recognition
illuminated his face, a triumphant ray of joy and satisfaction. He
tried to speak, but could not, but Anna felt the faint pressure of his
hand.
Once more his lips moved, and Anna saw rather than heard the
words:—
“Good-by, darling,” and with them the same look of ineffable love
and peace. Then his eyes closed and he sank again into
unconsciousness.
The physician, leaning over, said softly, “He will not rouse again.
This was most unexpected. He has been unconscious since
morning.”
The end came soon after midnight, unconsciousness falling into
death without pain or struggle.
Of the days which followed Anna could never recall a distinct or
coherent impression. Detached scenes and moments alone lived in
her memory.
She knew that Everett was there and that they started for Fulham.
Somewhere on the way Professor Ward met them, and Foster, the
old family servant. Nothing seemed strange and nothing seemed
natural; all passed to her as in a dream.
She was at Fulham; she remembered afterward that she sat in the
library which Keith had longed for so, and his body lay beside her,
below the mantelpiece where she had so often seen him lean. The
old servants, hastily summoned for the occasion, went and came,
and looked at her, she thought, with eyes of cold respect and mute
reproach. Then Everett stood there, and she saw that tears were on
his face as he looked upon his old friend, but she did not cry. Only
when Everett turned toward her she said, very simply, with a motion
of her hand which signified all that the place meant:—
“Keith gave his life—for me.” Then Everett had looked at her as if
alarmed at what he saw in her face, and had gone out hastily and
sent some woman to her, whom she did not want.
The incidents of the funeral seemed to pass by unnoticed. She
remembered the moment at the grave when at last she fully realized
that this was the end. Then she was at the Fulham railroad station,
and Professor Ward had come to her on the train and had held her
hands strongly in his, and had said with urgent emphasis:—
“You must always remember that Keith’s physician and all his old
friends believe that his life was prolonged rather than shortened by
your living in the South. Do not for a moment dwell on the opposite
thought.”
She had felt her dry lips tremble then and her eyes grew dim, but
she did not speak. The train had moved out soon, and she knew that
kind eyes watched her, but she could not meet their look.
Of the journey down into the West to her mother that night she
remembered nothing, save that the incessant jar of the train seemed
to follow in a rhythmic endless repetition the familiar refrain of the
old passion hymn,—
“Was ever grief like mine?”
CHAPTER XXXVII
From the unhappy desire of becoming great;
Preserve us, gracious Lord and God.
—Old Moravian Liturgy.

There is a time when religion is only felt as a bridle that checks us, and then
comes another time when it is a sweet and penetrating life-blood, which sets in
motion every fibre of the soul, expands the understanding, gives us the Infinite for
our horizon, and makes all things clear to us.—Lacordaire.

On the quiet street of the hill town of Bethlehem stands the quaint
and ancient building set apart in the Moravian economy as the
Widows’ House.
In the interior of the old stone house, with its massive walls and
rows of dormer windows, are wide, low-ceiled halls, and sunny,
sweet-smelling chambers, clean and orderly, chaste and simple, as
those of a convent. Here in mild monotony and peace the women of
the “Widows’ Choir” live their quiet life, and here in September we
find Anna Burgess, who had fled to this haven of her mother’s
abiding-place, as to a sanctuary.
The evening was warm, and the windows of Gulielma Mallison’s
room were open to the sunshine and the sweet air. Flowers
blossomed in the deep window-sills; the bare floor was as white as
scrubbing could make it; the appointments of the room were
cheerful and refined, albeit homely, and the atmosphere was that of
still repose. By the window Gulielma Mallison sat knitting, her face
beneath its widow’s cap calm and strong in its submissive sadness.
Opposite her on the sofa lay Anna, each line of her face and figure
expressing the suffering of a stricken heart. There had been months
of slow, wearisome illness and of grievous mental suffering, in which
her days had been a Purgatorio and her nights an Inferno; and now
weeks of convalescence, which were bringing life back into her
wasted frame, still failed to bring healing to her mind.
The mother’s fond eyes, glancing unperceived across her knitting,
noted the listless droop of the long white hands upon the white
dress, the marblelike pallor of the forehead from which the hair was
so closely drawn, the hollow cheeks, the piteous sadness of the
mouth, the glassy brightness of the eyes, fixed in the long, still gaze
of habitual introspection.
“Surely,” sighed Gulielma Mallison to herself, as she had before a
hundred times, “there is more than the bitterness of death in her
face; widowhood alone to the Christian brings not such havoc as
this. It is in some place of danger that her thoughts are dwelling. I
should fear less for her if she could only speak!”
But Anna’s grief could not find its way to words. How could her
mother, in her sober, ordered existence, her decorous and righteous
experiences of life and love and death, comprehend what it was to
live with shadows of faithlessness, even of blood-guiltiness, for
perpetual company? For to Anna’s thought Keith had been driven to
his lonely death by the hardness of Gregory, by words which had
issued from the white heat of his passion for her, a passion
unrebuked by her,—nay, rather, shared to the full. Was she then
guiltless of her husband’s death?
Not for a moment could Anna divide herself from Gregory in
responsibility for the action which Oliver had characterized as “moral
murder.” Unsparingly just to herself, she bore to the very limit of
reason all the fellowship which was imposed upon her by the
mastery of a love so long lived in its unconsciousness and silence, so
soon cut off, once perceived and acknowledged. It has been said
that “all great loves that have ever died, dropped dead.” Anna’s
mighty passion had been stillborn, slain by the words which had sent
Keith on his dim way to death. For she had never doubted that
Oliver’s rehearsal of the scene in the woods between Gregory and
Keith had been substantially true. She knew there had been spiritual
violence done, and her soul recoiled from the very strength and
power which had once enchained her. Something of diabolical pride
seemed to her now to invest even the austere morality of Gregory.
He would have spurned a yielding to the weakness of the flesh, his
moral fastidiousness would have made it impossible; but he fought
the fire of love fiercely with the fire of pride, not humbly with the
weapons of prayer. No shield of faith nor sword of the spirit had
been his in the hour of temptation, for all his high ideals, but the
sheer, elemental force of human will. He had conquered, or rather
had grappled with, the one passion; but the very force by which he
had conquered turned again and conquered him, and his very power
became his undoing.
Beside this conception of Gregory which had now taken
possession of Anna’s mind, Keith’s gentleness, his faithful, patient
life, above all, the greatness of the silent sacrifice which he had
made for her sake when he embarked on the Fraternia adventure,
became sacred and heroic. She saw at last what his leaving his
normal life had been; she believed, as she had said to Everett, that
he had literally given his life for her, and the sense of his devotion,
so little understood, so scantily recognized, wore ceaselessly at her
heart. Her one drop of balm was the memory of Keith’s last smile of
triumphant love and faith; the bitterest drop in her Cup of Trembling
that not one last word had been given her to show her by what
paths his soul had fared, and whether thoughts of peace had
lightened his sufferings. Having loved her, he had loved her to the
end,—this only she knew. His faithfulness had not failed.
Words which her father had spoken to her shortly before his
death, vaguely comprehended at the time, haunted her now, “With
greatness we have nothing at all to do; faithfulness only is our part.”
If only she had earlier discerned their meaning!
Such shape did these two men take to Anna now; the one who
had moulded all her outward life and touched her inner life hitherto
so faintly, the other who had mastered her in her innate longing for
power and freedom, and controlled her inner life for many years:
Keith seemed to her now like some spirit of gentle ministration,
humble, faithful, undefiled; Gregory, like some proud spirit, even as
Lucifer, son of the morning, who had said, ‘I will ascend into heaven,’
but who had been brought down to hell, dragging with him all that
was highest and holiest. And she had thought him so different! Like
another, her heart would cry out:—
“I thought that he was gentle, being great;
O God, that I had loved a smaller man!
I should have found in him a greater heart.”

Once, some weeks earlier, there had come to her a brief note from
Gregory, written soon after his return to Fraternia. It said only:—
“I have sinned deeply, against God; against him; most of all
against you. I cannot even venture to ask you to forgive. I can only
say to you, the penalty is wholly mine to bear. You are blameless.”
Having read the note, Anna threw it into the fire, and wrote no
word in return.
And for herself—?
There was no softness of self-pity in Anna’s remorse. Dry and
tearless and despairing, she saw herself, after long years of spiritual
assurance, of established and unquestioned righteousness,
overwhelmed at last by sin; not by the delicate and dainty and
inconclusive discords which religious experts love to examine and
analyze, but by a gross ground-swell of primitive passion, linking her
with men of violence and women of shame.
Looking back upon her girlhood, Anna thought with sad self-
scorning of her young desire for “a deeper sense of sin.” It had come
now, not as the initial stage in a knowledge of God, and of her
relation to him, but as a tardy revelation of the possibility of her
nature, undreamed of in her long security. The cherished formulas of
the old system, its measure of rule and line applied to the
incalculable forces of the human spirit; its hard, inflexible mould into
which the great tides of personal experience must be poured,
seemed to lie in fragments about her now, like wreckage after a
storm. She remembered that Professor Ward had once spoken to her
of her inherited religious conceptions as terrible in their power to
mislead, to deceive the heart as to itself; she saw the danger of a
belief founded not on infinite verities, but on a narrow mediæval
logic. She knew sin at last, and knew that it was not slain in the hour
of spiritual awakening.
She thought of the night preceding her union with her father’s
church, and the recoil of nameless dread with which she had seen
passing under her window the village outcast whom she supposed to
be incredibly guilty and cut off from fellowship with all who, like
herself, were seeking God. And it was that very night that she had
first dreamed of the mighty personality, the embodiment of power
and greatness, which she had thought to find in Gregory. Though
late, she now clearly perceived that in no human being could that
ideal of her dream find full manifestation.
Such thoughts as these were passing behind the pale mask of
Anna’s pain-worn face, which her mother’s eyes were watching. The
impress of suffering which they gave was hard to see, and a long
involuntary sigh escaped Gulielma Mallison’s lips.
Anna looked up with eyes as sad as those of Michel Angelo’s
Fates.
“Mother dear,” she said, her voice strangely dulled from its former
clear cadence, “why do you sigh? Do I make you unhappy?”
“I cannot comfort you, Anna Benigna,” said the mother,
sorrowfully. “It is for that I sigh.”
“No,” Anna said slowly, her eyes falling again from her mother’s
face; “you cannot do that, no one can. No one lives who can comfort
your child, mother.”
“I have often thought, Anna, that you may have suffered,” the
mother ventured almost timidly, “as many others have, from the sad
mistakes so common to people who regard the Christian life and the
married life as ends, instead of beginnings.”
Gulielma noticed a slight quickening of interest in Anna’s eyes, and
went on thoughtfully, with her simple philosophy of life:—
“To read the books that are written, and to hear the things that
are said, young people can hardly help supposing that when they
become Christians they will know no more of sin, and when they are
married they will have only joy and perfect union. To my way of
thinking, these wrong ideas are responsible for a great deal of
needless unhappiness. The Christian life is really a school, with hard
discipline and harder lessons. As for marriage—”
“Well,” said Anna, as her mother paused, “as to marriage?”
“It may be a crown,” said Gulielma, slowly, “but it is sure to be in
some measure a cross. It is a testing, a trial, a discipline, like the
rest of life. Only, whether it happens to be happy, or happens to be
hard, it is equally to be borne faithfully and in the fear of God.”
There was silence for a little space, and then a laughing voice in
the street outside, called:—
“Mrs. Mallison!”
Gulielma rose and stepped to the window, looking out over the
crimson and purple asters into the street. A young girl who stood
there handed her up a letter.
“I don’t know whether it belongs to Mrs. Burgess or not. The
address has been changed so many times, but the postmaster said I
was to ask you.”
“Very well,” was the answer, and as Gulielma turned back, a letter
in her hand, she found Anna sitting up, leaning upon her elbow, her
eyes strangely eager. She held out her hand, not speaking, and
received the letter. The upper line, which struck her eyes instantly,
was her own name, and it had been written by Keith. She could not
be mistaken. The mother’s anxious eyes saw every trace of colour
ebb away from Anna’s face and lips, and then stream back until the
faint flush rose to her forehead. She had not stopped to decipher the
many addresses written below, crossed and recrossed by many
pens, but, seeing her own name written by the dear dead hand, she
pressed the letter hard against her heart and so lay a moment,
silent.
Soon she looked up and met her mother’s eyes. A wistful, heart-
breaking request was in her own, which she hardly dared to speak.
“May I be all alone, mother?” she asked faintly; “my letter is from
him. It has gone wrong, but it has come to me, you see, at last. In
the morning I will see you. I will tell you then—all.”
In another minute, the door quietly closing, Anna found herself
alone. Breaking the seal, she saw that the letter had been written
three days before Keith’s death. An error in the original address,
doubtless due to his exhaustion, had sent it far astray. The letter
said:—
My own Anna,—I am here in Raleigh in a comfortable house, and with kind
people, but I fear that I am very ill, and that the end is now not far away, and I
want you as soon as you can come to me. I hope there will be no need of
alarming you with a telegram, for I know that you will start as soon as this
reaches you, and that will be in good time.
Do not think that this crisis is sudden and unforeseen. The physician in
Baltimore told me plainly that I could have but a short time to live, and when I
knew that I hastened to reach you as quickly as I might. It was for you only, Anna,
in all the world that I longed. I believed that a few weeks of quietness were for us,
not harder than we could bear, being together.
I think you will know that something turned me back almost at my journey’s
end. John Gregory is honest, and he will tell you, if indeed he knows himself.
I do not know now what he said to me, I do not care to remember. Whatever it
was it should have had no weight, being spoken, I know, under some strong
excitement, but with it there went that strange, irresistible influence which
Gregory exerts over me, and before which I was, or seemed to myself, powerless.
I felt his will was for me to go back, not onward to you, and I yielded as if unable
to do otherwise. I do not know, I cannot understand. I wish it had not been so,
but rather for him than for myself, for I know that in his higher mood the thought
of that night must be hateful to him.
I want to say now while I can that neither you nor he must look upon these
events in a way to exaggerate or overemphasize their importance. I can see that
you with your sensitive conscience and he with his great moral severity may judge
over hardly. The difference to me has not been great. The end was very near, and
is not hastened, and I shall see you yet before it comes. If I had not been weak I
should have kept on my way. It was my weakness that sent me back rather than
the outward compulsion.
I shall not want to talk of this when I see you, Anna, and so I will write to-day
some things which have come to my mind this winter, for I have come to see
many things in a new light.
John Gregory loves you. I do not blame him for that, nor wonder. “We needs
must love the highest when we see it.” He is a man of great power and of the
highest spiritual ambition. He is far nearer to you in ability than I; he could enter
more deeply into your purposes and sympathize in fuller measure with your
intellectual life. I believe you could have loved him, if you had been free, and that
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!

ebooknice.com

You might also like