Download full Image Processing and Computer Vision in iOS Oge Marques ebook all chapters
Download full Image Processing and Computer Vision in iOS Oge Marques ebook all chapters
com
https://textbookfull.com/product/image-processing-and-
computer-vision-in-ios-oge-marques/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/nonlinear-eigenproblems-in-image-
processing-and-computer-vision-guy-gilboa/
textboxfull.com
https://textbookfull.com/product/computer-vision-pattern-recognition-
image-processing-and-graphics-renu-rameshan/
textboxfull.com
https://textbookfull.com/product/image-processing-computer-vision-and-
pattern-recognition-hamid-r-arabnia/
textboxfull.com
https://textbookfull.com/product/feature-extraction-and-image-
processing-for-computer-vision-fourth-edition-aguado/
textboxfull.com
Computer Vision and Image Analysis Digital Image
Processing and Analysis 4th Edition Scott E Umbaugh
https://textbookfull.com/product/computer-vision-and-image-analysis-
digital-image-processing-and-analysis-4th-edition-scott-e-umbaugh/
textboxfull.com
https://textbookfull.com/product/feature-extraction-and-image-
processing-for-computer-vision-4th-edition-mark-nixon/
textboxfull.com
https://textbookfull.com/product/applied-computer-vision-and-image-
processing-proceedings-of-iccet-2020-volume-1-brijesh-iyer/
textboxfull.com
Oge Marques
Image Processing
and Computer
Vision in iOS
1 23
SpringerBriefs in Computer Science
Series Editors
Stan Zdonik, Brown University, Providence, RI, USA
Shashi Shekhar, University of Minnesota, Minneapolis, MN, USA
Xindong Wu, University of Vermont, Burlington, VT, USA
Lakhmi C. Jain, University of South Australia, Adelaide, SA, Australia
David Padua, University of Illinois Urbana-Champaign, Urbana, IL, USA
Xuemin Sherman Shen, University of Waterloo, Waterloo, ON, Canada
Borko Furht, Florida Atlantic University, Boca Raton, FL, USA
V. S. Subrahmanian, Department of Computer Science, University of Maryland,
College Park, MD, USA
Martial Hebert, Carnegie Mellon University, Pittsburgh, PA, USA
Katsushi Ikeuchi, Meguro-ku, University of Tokyo, Tokyo, Japan
Bruno Siciliano, Dipartimento di Ingegneria Elettrica e delle Tecnologie
dell’Informazione, Università di Napoli Federico II, Napoli, Italy
Sushil Jajodia, George Mason University, Fairfax, VA, USA
Newton Lee, Institute for Education, Research, and Scholarships, Los Angeles,
CA, USA
SpringerBriefs present concise summaries of cutting-edge research and practical
applications across a wide spectrum of fields. Featuring compact volumes of 50 to
125 pages, the series covers a range of content from professional to academic.
Typical topics might include:
• A timely report of state-of-the art analytical techniques
• A bridge between new research results, as published in journal articles, and a
contextual literature review
• A snapshot of a hot or emerging topic
• An in-depth case study or clinical example
• A presentation of core concepts that students must understand in order to make
independent contributions
Briefs allow authors to present their ideas and readers to absorb them with minimal
time investment. Briefs will be published as part of Springer’s eBook collection,
with millions of users worldwide. In addition, Briefs will be available for individual
print and electronic purchase. Briefs are characterized by fast, global electronic
dissemination, standard publishing contracts, easy-to-use manuscript preparation
and formatting guidelines, and expedited production schedules. We aim for pub-
lication 8–12 weeks after acceptance. Both solicited and unsolicited manuscripts
are considered for publication in this series.
**Indexing: This series is indexed in Scopus, Ei-Compendex, and zbMATH **
This Springer imprint is published by the registered company Springer Nature Switzerland AG.
The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
To Ingrid, with eternal gratitude for her
unfailing support.
Preface
This book was motivated by the synergy between two main driving forces in today’s
technological landscape: (1) the maturity and popularity of image processing and
computer vision (IPCV) techniques and algorithms; and (2) the unprecedented
success of iOS-powered mobile devices, such as iPhone and iPad. The combination
of these techniques and skills has been driving the emerging era of mobile visual
computing.
This book presents a technical overview of some of the tools and technologies
currently available for developing iOS applications with IPCV capabilities, includ-
ing the latest advances on the use of machine learning and deep learning to build
intelligent IPCV apps. Its main goal is to provide the reader a guided tour of what is
currently available and a path to successfully tackle this rather complex, but highly
rewarding, task.
This book is targeted at developers, researchers, engineers, and students who
might need a roadmap to navigate the ever-changing maze of languages, libraries,
frameworks, and APIs involved in developing IPCV applications for iOS.
The following are some of the highlights of each chapter in this book:
• Chapter 1 introduces the field of mobile visual computing and provides support-
ing facts and statistics that motivate the development of iOS apps in this space.
• Chapter 2 provides an overview of the basic steps in image processing and
computer vision as well as the main aspects of the process of developing iOS
applications for IPCV, with a particular emphasis on libraries and frameworks
related to acquiring, storing, processing, and displaying images.
• Chapter 3 introduces the Core Image library and shows the examples of using
Core Image for image filtering and face detection.
• Chapter 4 provides a quick conceptual review of Machine Learning and Deep
Learning as well as an up-to-date coverage of how to develop intelligent IPCV
apps using Core ML and Create ML.
• Chapter 5 presents Apple’s Vision Framework and shows how it can be integrated
with Core ML to develop intelligent IPCV apps.
vii
viii Preface
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 The Age of Mobile Visual Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Mobile Visual Computing and iOS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Image Processing and Computer Vision iOS App Development:
The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 Image Processing, Image Analysis, and Computer Vision . . . . . . . . . . . . . 7
2.2 The iOS Development Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Useful Frameworks, APIs, and Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4 Learn More About It . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3 Core Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2 Fundamental Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.3 Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.4 Face Detection Using Core Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.5 Auto Enhancement Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.6 Learn More About It . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4 Machine Learning with Core ML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.1 Machine Learning: The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2 The Era of Deep Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.3 Core ML Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.4 Using Pre-trained Models with Core ML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.5 Training Your Own Models with Create ML . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.6 Computer Vision and Core ML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.7 Learn More About It . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
ix
x Contents
1.1 Motivation
This book was motivated by two main factors: (i) the maturity and popularity
of image processing and computer vision techniques and algorithms; and (ii) the
unprecedented success of iOS-powered mobile devices, such as iPhone and iPad.
On one side of the equation lie the mature fields of digital image processing and
computer vision, whose techniques and algorithms have left the realm of exclusively
scientific pursuits and associated demanding requirements (notably, the need for
expensive, specialized hardware and software) to reach the lives of computer users
and developers of virtually all levels. Digital cameras became ubiquitous over the
past few years, to the point that we inevitably think of film-based cameras (and
tape- or disk-based camcorders) as a thing of the past. The wide availability of
image editing, retouching, and processing software helped popularize imaging terms
and increase the use of image processing techniques, e.g., posterization, gamma
correction, or Gaussian blur, to name but a few. The area of computer vision
also experienced a transition through which the most successful algorithms for
frequently used tasks have become commodities, available through libraries, several
of which are open and free for developers and users.
On the other side of the equation lies the iPhone, originally released by Apple
in 2007, which has revolutionized the smartphone industry with more than 2.2
billion units sold worldwide since then [6]. The tremendously successful iPhone
was later joined by Apple’s electronic tablet, the iPad, which—since its release in
2010—has sold more than 425 million units [5]. In their latest generations, both
the iPhone and the iPad have a wide range of rich capabilities, including built-in
camera sensors, multi-touch screen, and powerful processors, which have made it
possible to conceive and develop applications that perform rich and complex image
processing and computer vision tasks “on the go”.
We live in a world where images and videos are, indeed, everywhere [20]!
Recent statistics indicate that more than 3.2 billion people have a smartphone with
camera [10]. Thanks to technological developments during the past 25 years, there
has been a significant increase in the production and consumption of visually rich
contents, including high-quality images and high-definition videos. This growth has
been accompanied by a shift towards performing many of these tasks, much of the
time, using mobile devices such as iPhone and iPad.
There is, however, a big mismatch between the processes of producing visual
resources and organizing them for further cataloguing and consumption. Production
tasks (such as capturing, producing, editing, sharing, remixing, and distributing
visual content) have become easier thanks to an extensive array of highly-capable
devices and powerful apps. Organizational tasks (such as annotating, tagging,
making sense of, searching for, and retrieving visual content), however, remain
difficult and expensive.
Taking pictures and videos has become an easy and inexpensive task. The increasing
popularity of smartphones has made it possible to carry a photo camera and video
recorder (app) at all times. The resolution and quality of images and videos produced
with a smartphone camera are appropriate for everyday needs and even acceptable
for venturing into amateur photography. The popularization of using smartphone
cameras can be attested by the birth of a new term: iPhoneography, defined as
“the art of shooting and processing photos with an Apple iPhone” [21].
1.2 The Age of Mobile Visual Computing 3
It has never been easier to enhance and fix a photo or perform basic video editing
(such as trimming a video clip) and today’s smartphones provide built-in features
for such tasks. If the functionality provided by the smartphone’s operating system
and built-in apps is not enough, there are plenty of options to choose from: it is
estimated that 2% [2] of the 1.85 million apps available at the Apple App store [11]
belong to the Photo and Video category, which translates to more than 37,000 iOS
apps to chose from!
There are tens of websites (with companion iOS apps) for photo hosting and sharing
to choose from, including: Flickr, Google Photos, SmugMug, 500px, Dropbox, and
Amazon Prime Photos.
On the video arena, YouTube is—by far—the larger and most popular website for
hosting user-generated videos, with more than 2 billion monthly users [18], an order
of magnitude larger than one of its closest competitors, Vimeo [1]. Astonishingly
enough, more than 500 hours of video content are uploaded to YouTube every
minute [17]. The platform, which was created in 2005 (and acquired by Google
for $1.65 billion USD in late 2006), has become one of the most visited websites
in the world and a global phenomenon. Approximately 60% of mobile users in the
U.S. access YouTube via a mobile device (smartphone or tablet) [15].
When it comes to social sharing of photos, Facebook, Instagram, WhatsApp,
and Snapchat are the leading apps—at least 350 million photos are uploaded to
Facebook every day [4], and Snapchat, Instagram, and WhatsApp users (combined)
share at least 7.5 billion photos each day [8, 12, 16]. Other noteworthy players in
the space of social media sharing of images and videos include TikTok, Periscope,
and DailyMotion.
The field of computer vision is advancing more rapidly than ever before. Many
sophisticated algorithms for image processing and analysis have become available
as commodities, thanks to the popularization of libraries such as Core Image (see
Chap. 3) and OpenCV (see Chap. 6).
The growing use of deep learning algorithms to solve computer vision problems
has energized the field and advanced the state of the art in several areas, from image
classification to object detection and tracking, from image denoising to semantic
image segmentation. It is now possible to use sophisticated pre-trained models
for tasks such as age estimation, gender classification, and many others to build
intelligent mobile apps with relative ease (see Chaps. 4 and 5).
In summary, iOS-based devices have become a rich platform for the development
of mobile apps with rich visual computing capabilities in a wide variety of
domains, from entertainment, to healthcare, to education. Thanks to Core Image,
Core ML and the Vision Framework, the iOS ecosystem allows developers to
create amazingly rich apps with intelligent visual processing capabilities, whose
complexity is conveniently abstracted behind pre-trained models and powerful
libraries.
References 5
References
Digital image processing can be defined as the science of modifying digital images
by means of carefully designed algorithms running on a digital computer—which,
for the sake of this book, is an iPhone or iPad.
Traditionally, image processing operations used to be classified in three lev-
els [41]:
• Low-level: primitive operations (e.g., noise reduction, contrast enhancement,
etc.) where both the input and output are images.
• Mid-level: extraction of attributes (e.g., edges, contours, regions, etc.) from
images.
• High-level: analysis and interpretation of the contents of a scene.
Since there is no universal terminology to delimit the boundaries between image
processing, image analysis, and computer vision, for the sake of this chapter we will
adopt the following convention:
• Image processing: operations where the input is an image,1 and the output is a
modified version of the image. Examples of techniques and algorithms in this
category include: denoising (Fig. 2.1), sharpening, blurring, pseudocoloring, etc.
• Image analysis: operations where the input is an image and the output is a
labeled image, where specific regions, edges, or contours from the input image
have been outlined. Examples of techniques and algorithms in this category
include: semantic segmentation (Fig. 2.2), corner detection, and edge extraction,
among many others.
1 Depending on the algorithm, the input could also be a series of (2D or 3D) images and/or one or
more videos. This is valid for all three categories described here.
Fig. 2.1 Image processing example—denoising: (a) input image; (b) output image
Fig. 2.2 Image analysis example—semantic segmentation: relevant portions of the image have
been automatically assigned a (color-coded) label, such as pedestrian, car, road, or sky
Fig. 2.3 Computer vision example—image classification: an image classifier (usually a pre-
trained neural network) takes an image as input and produces the most likely label for that image
Fig. 2.4 IPCV pipeline example: original image (left), filtered (center), and subsequently cropped
(right)
pipeline (or workflow) usually consists of several operations that are chained
together in a meaningful sequence. For example, an image may be filtered and
cropped before being used as an input to an object classifier (Fig. 2.4).
During the past two decades, thanks to the popularization of libraries, frame-
works and toolboxes such as OpenCV [39] (for C++ and Python developers),
MATLAB [24] (and its toolboxes2), ImageJ [20] and Fiji [16] (for Java developers),
and many others, the building blocks of the IPCV pipeline have become commodi-
ties. More often than not—whether you are a developer, student, practitioner, or
engineer—the fundamental operations behind each stage in your IPCV pipeline are
immediately available through library functions. More recently, many of the most
sophisticated algorithms for intelligent processing of visual information have also
become available via cloud-based services and their APIs (e.g., Microsoft Azure
Cognitive Services [8], Amazon AWS [1], Google Cloud AutoML [7]) which has
led to enormous flexibility in building web-based vision applications.
Moreover, the impact of deep learning techniques on image processing and
computer vision since the successful image classification results obtained by
Krizhevsky et al. in ImageNet 2012 [40] has been so significant that there are
deep-learning-based versions of virtually every IPCV task, often achieving state-
of-the-art results for that task.3
2 Notably the Image Processing, Deep Learning, and Computer Vision toolboxes.
3 It
is commonly said that the history of computer vision will be written in two volumes: (i) before
deep learning (1950s–2012); and (ii) after deep learning (2012–present).
10 2 Image Processing and Computer Vision iOS App Development: The Basics
Most importantly for the sake of this book, the iOS ecosystem offers a rich
platform for developing IPCV apps, thanks to several frameworks, libraries, and
APIs (Sect. 2.3), particularly Core Image (Chap. 3), Core ML (Chap. 4), and the
Vision Framework (Chap. 5). Moreover, the rich functionality of OpenCV can also
be accessed by iOS apps (Chap. 6).
Xcode
Xcode [36] is the Integrated Development Environment (IDE) for designing, coding,
debugging, and testing iOS apps. It includes a text editor where you write the source
code that defines what your app does and a visual editor where you design your app’s
user interface [21].
Xcode also includes a compiler, a debugger, and a vast array of features for iOS
app development. You can download Xcode for free from the Mac App Store. At the
time of writing, the latest version of Xcode is Xcode 12, which assumes that you use
Swift as a programming language and includes the new SwiftUI framework [21].
Swift
In the early days of iOS programming, the language of choice was Objective-C.
Most of the code for iOS today is written in Swift. However, for legacy apps or IPCV
apps that need to interface with OpenCV (see Chap. 6), knowledge of Objective-C
and/or C++ is crucial.
The Swift programming language was announced in 2014 at Apple’s World-
wide Developers Conference (WWDC) and has become one of the most popular
programming languages since then. It supports the object-oriented and functional
programming paradigms that most programmers are comfortable with, and it also
introduces a new one: protocol-oriented programming [21].
Swift prevents many common programming errors by adopting modern program-
ming patterns, such as [32]:
• Variables are always initialized before use.
• Array indices are checked for out-of-bounds errors.
• Integers are checked for overflow.
• Optionals ensure that nil values are handled explicitly.
• Memory is managed automatically.
• Error handling allows controlled recovery from unexpected failures.
2.3 Useful Frameworks, APIs, and Libraries 11
From the very beginning of iOS programming and up to iOS 12, iOS apps were
written using the iPhone’s original user interface framework, UIKit. UIKit was
designed at a time when the general philosophy behind mobile app development
was that mobile apps are like desktop apps, but on a less-powerful computer with
a tiny screen. The overwhelming majority of iOS apps and their code are based on
UIKit [21].
iOS 13 introduced SwiftUI, a new way for iOS developers to build user
interfaces for their apps and to make it easier to port iOS apps to Apple’s other
platforms: macOS, watchOS and tvOS. If you’re new to iOS development, experts
recommend that you learn UIKit first and then transition to SwiftUI [21].
To conclude this section, these are the suggested steps to learn the basic steps that
should lead you to become a successful developer of IPCV iOS apps.
1. Get a Mac computer. You will need a Mac to run Xcode.
2. Download and install Xcode [36].
3. Sign up with Apple to become a registered iOS developer [2].
4. Learn the basics of iOS programming using Swift.4
5. Get an iPhone and/or iPad to test your apps.5
6. Learn about useful Apple frameworks, libraries, and APIs for IPCV tasks (see
Sect. 2.3), particularly Core Image (Chap. 3), Core ML (Chap. 4), and the Vision
Framework (Chap. 5).
7. Read as much as you can (books, blogs, Apple documentation, tutorials, etc.).
8. Practice, practice, practice.
This section contains a list (in alphabetical order) of the most relevant Apple frame-
works, APIs, and libraries for iOS developers working in IPCV and related areas
4 This is a potentially time-consuming step, since it involves learning a new programming language
and many software development aspects that are crucial to mobile app development. Fortunately,
there are plenty of resources online to learn them, some of which appear at then end of this chapter.
5 You can test much of the functionality of an iOS app using the iOS simulator that is bundled with
Xcode, but for certain aspects of some apps (e.g., live video capture) you must deploy and test on
a physical device.
12 2 Image Processing and Computer Vision iOS App Development: The Basics
ARKit
One of the most exciting developments in mobile app development in recent years
has been the growth of Augmented Reality (AR) [4]—often called mixed reality—
apps, which allow the creation of “user experiences that add 2D or 3D elements to
the live view from a device’s camera in a way that makes those elements appear to
inhabit the real world” [3].
ARKit is a framework that combines device motion tracking, camera scene
capture, advanced scene processing, and display conveniences to simplify the task
of building an AR experience, using the front or rear camera of an iOS device [3].
AVFoundation
AVKit
AVKit is a framework that provides a high-level interface for playing video content,
by allowing the creation of view-level services for media playback, complete with
user controls, chapter navigation, and support for subtitles and closed captioning [6].
2.3 Useful Frameworks, APIs, and Libraries 13
Core Graphics
The Core Graphics framework is based on the Quartz advanced drawing engine
available for iOS, tvOS and macOS application development. Quartz 2D provides
low-level, lightweight 2D rendering with unmatched output fidelity. Quartz 2D is
resolution- and device-independent. You can use the Core Graphics framework to
handle path-based drawing, transformations, color management, offscreen render-
ing, patterns, gradients and shadings, image data management, image creation, and
image masking, as well as PDF document creation, display, and parsing [9].
The Quartz 2D API is easy to use and provides access to powerful features
such as transparency layers, path-based drawing, offscreen rendering, advanced
color management, anti-aliased rendering, and PDF document creation, display, and
parsing [29].
Core Image
Core Image encapsulates image processing and analysis technologies that provide
high-performance processing for still and video images. it includes many built-
in image filters that can be used to process images and build complex effects by
chaining filters [10]. Chapter 3 explores Core Image in greater detail.
Core Media
The Core Media framework defines the media pipeline used by AVFoundation
and other high-level media frameworks found on Apple platforms. You can use Core
Media’s low-level data types and interfaces to efficiently process media samples and
manage queues of media data [11].
Core ML
Core Video
Core Video provides a pipeline model for digital video. It simplifies working with
video by partitioning the process into discrete steps, which makes it easier for
developers to access and manipulate individual frames without having to worry
about translating between data types or display synchronization issues [13].
Create ML
Create ML allows developers to create and train custom machine learning models
to perform tasks such as recognizing images, extracting meaning from text, or
finding relationships between numerical values [14]. Section 4.5 provides additional
information on how to use Create ML to create intelligent iOS apps.
Image I/O
ImageCaptureCore
Metal
ML Compute
OpenGL ES
The OpenGL ES framework was one of the earliest 2D and 3D graphics frameworks
in iOS. It was made available with iOS 2 and deprecated in iOS 12 in favor of the
Metal framework [27].
PhotoKit
PhotoKit provides support for building photo-editing extensions for the Photos app,
including direct access to the photo and video assets managed by the Photos app.
Using PhotoKit, you can fetch and cache assets for display and playback, edit image
and video content, or manage collections of assets such as albums, Moments, and
Shared Albums [28].
VideoToolbox
Vision
The Vision Framework [37], introduced in iOS 11, encapsulates advanced capabil-
ities for handling face detection and recognition, barcode and QR code detection,
text detection, horizon detection, image registration (alignment), as well as object
detection and tracking. It also interfaces with Core ML (Chap. 4) models for image
analysis and machine learning tasks in the same workflow. Chapter 5 explores the
Vision Framework in greater detail.
VisionKit
VisionKit is a small framework, introduced in iOS 13, that allow you to use the iOS
camera as a document scanner [35].
The official Apple site for Swift contains links to numerous books, sample code
examples, videos, university courses, and official Apple documentation [31].
Ray Wanderlich’s site is a rich source for high-quality books, tutorials, courses,
and videos on iOS and mobile app development [30].
Since the early days of iOS programming, Stanford University’s CS193p (Devel-
oping Applications for iOS) course has been a reference of high-quality materials
and instructions. Slides, reading materials, and lecture videos are freely available
online [15].
For a deeper look into design patterns and app architectures (and their limitations
and alternatives), and how the same app can be implemented using a handful of
different architectures, see [38].
Two special issues of the objc.io electronic magazine remain relevant for getting
a deeper understanding of the development process behind mobile visual computing
apps in iOS:
• Issue 21: Camera and Photos [22], which covers a wide range of topics, from
image acquisition using the iPhone camera to selected frameworks, extensions,
and GPU-accelerated apps.
• Issue 23: Video [23], which extends the discussion to video capturing, filtering,
and hardware acceleration.
References 17
References
33. Training a Neural Network with Metal Performance Shaders — Apple Developer Documenta-
tion. https://apple.co/3jvB9Ca. Accessed: 2020-07-22.
34. VideoToolbox — Apple Developer Documentation. https://apple.co/2Ef7xcb. Accessed: 2020-
07-22.
35. VisionKit — Apple Developer Documentation. https://apple.co/39pwEnT. Accessed: 2020-
07-22.
36. Xcode — Apple Developer. https://apple.co/2CInyXt. Accessed: 2020-07-22.
37. Apple Vision Framework. https://apple.co/37V2bxg, 2018. Accessed: 2020-06-23.
38. C. Eidhof. App architecture. objc, Berlin, Germany, 2018.
39. A. Kaehler and G. Bradski. Learning OpenCV 3: Computer Vision in C++ with the OpenCV
Library. O’Reilly Media, Inc., 2017.
40. A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional
neural networks. In Advances in neural information processing systems, pages 1097–1105,
2012.
41. O. Marques. Practical Image and Video Processing Using MATLAB. Wiley - IEEE. Wiley,
2011.
Chapter 3
Core Image
3.1 Introduction
Core Image is an image processing and analysis framework for iOS and macOS.
Core Image provides a broad array of useful image processing and computer vision
(such as face- and facial features detection in images and videos, and face tracking
in videos) as well as almost 200 built-in image filters, organized into more than a
dozen categories (Sect. 3.3) [7]. Moreover, thanks to its plug-in architecture, Core
Image allows users to extend its functionality by writing custom filters that integrate
with the system-provided filters [16].
Core Image has three classes that support image processing on iOS [8]:
• CIFilter is a mutable object that represents an effect. A filter object has at
least one input parameter and produces an output image.
• CIImage is an immutable object that represents an image, which can be
synthesized from image data, read from a file, or produced at the output of
another CIFilter object.
• CIContext is an object through which Core Image draws the results produced
by a filter. A Core Image context can be based on the CPU or the GPU.
Listing 3.1 shows the fundamental steps for processing an image using Core
Image methods specific to iOS. In line 2, a CIContext object is created with
1 import CoreImage
2 let context = CIContext()
3 let filter = CIFilter(name: "CISepiaTone")!
4 filter.setValue(0.8, forKey: kCIInputIntensityKey)
5 let image = CIImage(contentsOfURL: myURL)
6 filter.setValue(image, forKey: kCIInputImageKey)
7 let result = filter.outputImage!
8 let cgImage = context.createCGImage(result, from: result.extent)
Listing 3.1 The basics of applying a filter to an image on iOS [8]
default options. The code in lines 3–4 creates a filter1and sets values for its
parameters. In lines 5–6, a CIImage object representing the image to be processed
is created (in this particular case, using a URL as its source). In line 7, the output
image (another CIImage object) is produced (but not yet rendered). Finally, in line
8, the resulting image is rendered to a Core Graphics image, which can be displayed
or saved to a file [8].
3.3 Filters
Within the context of Core Image, a filter is an object that has a number of inputs
and outputs and performs some kind of transformation. For example, a sharpening
filter might take an input image and an additional (scalar) parameter indicating the
desired amount of sharpening and produce an output image with a crisper look.
A filter graph is a network (directed acyclic graph) of filters, chained together so
that the output of one filter can be used as the input of another; by chaining filters in
this way, elaborate effects can be achieved [16].
Core Image comes with dozens of built-in filters, organized into categories.2
A filter category specifies the type of effect—for example blur, color adjustment,
or halftone—or its intended use—still images, video, non-square pixels, and so on.
A filter can be a member of more than one category. A filter also has a display
name, which is the name used to show to users and a filter name, which is the
name used to access the filter programmatically. Since the list of built-in filters can
change over time, Core Image provides methods that allow for querying the system
for the available filters [8].
Most filters have one or more input parameters; each input parameter has an
attribute class that specifies its data type, such as NSNumber. An input parameter
can optionally have other attributes, such as its default value, the allowable
1 In this example, the filter is CISepiaTone, which maps the colors of an image to various shades
of brown.
2 The official Core Image Filter Reference [5] lists the filters currently available, their characteristics
I
the Reverend Jacob Trosper, D. D., Ph. D., LL. D., dean and
chief executive of Mizpah Theological Seminary, and Professor of
Practical Theology and Homiletics, was a hard-faced active man with
a large active voice. His cheeks were gouged with two deep
channels. His eyebrows were heavy. His hair, now gray and bristly,
must once have been rusty, like Eddie Fislinger’s. He would have
made an excellent top-sergeant. He looked through the students and
let them understand that he knew their sins and idlenesses before
they confessed them.
Elmer was afraid of Dean Trosper. When he was summoned to
the dean’s office, the morning after the spiritual conference in Frank
Shallard’s room, he was uneasy.
He found Frank with the dean.
“God! Frank’s been tattling about my doings with women!”
“Brother Gantry,” said the dean.
“Yes, sir!”
“I have an appointment which should give you experience and a
little extra money. It’s a country church down at Schoenheim, eleven
miles from here, on the spur line of the Ontario, Omaha and
Pittsburgh. You will hold regular Sunday morning services and
Sunday School; if you are able to work up afternoon or evening
services and prayer-meeting, so much the better. The pay will be ten
dollars a Sunday. If there’s to be anything extra for extra work—that’s
up to you and your flock. I’d suggest that you go down there on a
hand-car. I’m sure you can get the section-gang boss here to lend
you one, as it’s for the Lord’s work, and the boss’ brother does a lot
of gardening here. I’m going to send Brother Shallard with you to
conduct the Sunday School and get some experience. He has a
particularly earnest spirit—which it wouldn’t entirely hurt you to
emulate, Brother Gantry—but he’s somewhat shy in contact with sin-
hardened common people.
“Now, boys, this is just a small church, but never forget that it’s
priceless souls that I’m entrusting to your keeping; and who knows
but that you may kindle there such a fire as may some day illumine
all the world . . . providing, Brother Gantry, you eliminate the worldly
things I suspect you of indulging in!”
Elmer was delighted. It was his first real appointment. In Kansas,
this summer, he had merely filled other people’s pulpits for two or
three weeks at a time.
He’d show ’em! Some of these fellows that thought he was just a
mouth-artist! Show ’em how he could build up church membership,
build up the collections, get ’em all going with his eloquence—and, of
course, carry the message of salvation into darkened hearts.
It would be mighty handy to have the extra ten a week—and
maybe more if he could kid the Schoenheim deacons properly.
His first church . . . his own . . . and Frank had to take his orders!
II
In the virginal days of 1905 section gangs went out to work on the
railway line not by gasoline power but on a hand-car, a platform with
two horizontal bars worked up and down like pump-handles.
On a hand-car Elmer and Frank Shallard set out for their first
charge. They did not look particularly clerical as they sawed at the
handles; it was a chilly November Sunday morning, and they wore
shabby greatcoats. Elmer had a moth-eaten plush cap over his ears,
Frank exhibited absurd ear-muffs under a more absurd derby, and
both had borrowed red flannel mittens from the section gang.
The morning was icily brilliant. Apple orchards glistened in the
frost, and among the rattling weed-stalks by the worm-fences quail
were whistling.
Elmer felt his lungs free of library dust as he pumped. He
broadened his shoulders, rejoiced in sweating, felt that his ministry
among real men and living life was begun. He pitied the pale Frank a
little, and pumped the harder . . . and made Frank pump the harder
. . . up and down, up and down, up and down. It was agony to the
small of his back and shoulders, now growing soft, to labor on the
up-grade, where the shining rails toiled round the curves through
gravel cuts. But down-hill, swooping toward frosty meadows and the
sound of cowbells in the morning sun, he whooped with exhilaration,
and struck up a boisterous:
There is power, power, wonder-working power
In the blood
Of the Lamb—
The Schoenheim church was a dingy brown box with a toy
steeple, in a settlement consisting of the church, the station, a
blacksmith shop, two stores, and half a dozen houses. But at least
thirty buggies were gathered along the rutty street or in the carriage-
sheds behind the church; at least seventy people had come to
inspect their new pastor; and they stood in gaping circles, staring
between frosty damp mufflers and visored fur caps.
“I’m scared to death!” murmured Frank, as they strode up the one
street from the station, but Elmer felt healthy, proud, expansive. His
own church, small but somehow—somehow different from these
ordinary country meeting-houses—quite a nice-shaped steeple—not
one of these shacks with no steeple at all! And his people, waiting for
him, their attention flowing into him and swelling him—
He threw open his overcoat, held it back with his hand imperially
poised on his left hip, and let them see not only the black broadcloth
suit bought this last summer for his ordination but something choice
he had added since—elegant white piping at the opening of his vest.
A red-faced mustached man swaggered up to greet them,
“Brother Gantry? And Brother Shallard? I’m Barney Bains, one of the
deacons. Pleased to meet you. The Lord give power to your
message. Some time since we had any preachin’ here, and I guess
we’re all pretty hungry for spiritual food and the straight gospel. Bein’
from Mizpah, I guess there’s no danger you boys believe in this open
communion!”
Frank had begun to worry, “Well, what I feel is—” when Elmer
interrupted him with a very painful bunt in the side, and chanted with
holy joy:
“Pleased meet you, Brother Bains. Oh, Brother Shallard and I are
absolutely sound both on immersion and close communion. We trust
you will pray for us, Brother, that the Holy Ghost may be present in
this work today, and that all the brethren may rejoice in a great
reawakening and a bountiful harvest!”
Deacon Bains and all who heard him muttered, saint to saint,
“He’s pretty young yet, but he’s got the right idee. I’m sure we’re
going to have real rousing preaching. Don’t think much of Brother
Shallard, though. Kind of a nice-looking young fella, but dumm in the
head. Stands there like a bump on a log. Well, he’s good enough to
teach the kids in Sunday School.”
Brother Gantry was shaking hands all round. His sanctifying
ordination, or it might have been his summer of bouncing from pulpit
to pulpit, had so elevated him that he could greet them as
impressively and fraternally as a sewing-machine agent. He shook
hands with a good grip, he looked at all the more aged sisters as
though he were moved to give them a holy kiss, he said the right
things about the weather, and by luck or inspiration it was to the
most acidly devout man in Boone County that he quoted a homicidal
text from Malachi.
As he paraded down the aisle, leading his flock, he panted:
“Got ’em already! I can do something to wake these hicks up,
where gas-bags like Frank or Carp would just chew the rag. How
could I of felt so down in the mouth and so—uh—so carnal last
week? Lemme at that pulpit!”
They faced him in hard straight pews, rugged heads seen against
the brown wall and the pine double doors grained to mimic oak; they
gratifyingly crowded the building, and at the back stood shuffling
young men with unshaven chins and pale blue neckties.
He felt power over them while he trolled out the chorus of “The
Church in the Wildwood.”
His text was from Proverbs: “Hatred stirreth up strifes: but love
covereth all sins.”
He seized the sides of the pulpit with his powerful hands, glared
at the congregation, decided to look benevolent after all, and
exploded:
“In the hustle and bustle of daily life I wonder how many of us
stop to think that in all that is highest and best we are ruled not by
even our most up-and-coming efforts but by Love? What is Love—
the divine Love of which the—the great singer teaches us in
Proverbs? It is the rainbow that comes after the dark cloud. It is the
morning star and it is also the evening star, those being, as you all
so well know, the brightest stars we know. It shines upon the cradle
of the little one and when life has, alas, departed, to come no more,
you find it still around the quiet tomb. What is it inspires all great men
—be they preachers or patriots or great business men? What is it,
my brethren, but Love? Ah, it fills the world with melody, with such
sacred melodies as we have just indulged in together, for what is
music? What, my friends, is music? Ah, what indeed is music but the
voice of Love!”
He explained that hatred was low.
However, for the benefit of the more leathery and zealous
deacons down front, he permitted them to hate all Catholics, all
persons who failed to believe in hell and immersion, and all rich
mortgage-holders, wantoning in the betraying smiles of scarlet
women, each of whom wore silk and in her jeweled hand held a ruby
glass of perfidious wine.
He closed by lowering his voice to a maternal whisper and
relating a totally imaginary but most improving experience with a
sinful old gentleman who on his bed of pain had admitted, to Elmer’s
urging, that he ought to repent immediately, but who put it off too
long, died amid his virtuous and grief-stricken daughters, and
presumably went straight to the devil.
When Elmer had galloped down to the door to shake hands with
such as did not remain for Sabbath School, sixteen several auditors
said in effect, “Brother, that was a most helpful sermon and elegantly
expressed,” and he wrung their hands with a boyish gratitude
beautiful to see.
Deacon Bains patted his shoulder. “I’ve never heard so young a
preacher hand out such fine doctrine, Brother. Meet my daughter
Lulu.”
And she was there, the girl for whom he had been looking ever
since he had come to Mizpah.
Lulu Bains was a gray-and-white kitten with a pink ribbon. She
had sat at the back of the church, behind the stove, and he had not
seen her. He looked down at her thirstily. His excitement at having
played his sermon to such applause was nothing beside his
excitement over the fact that he would have her near him in his
future clerical labors. Life was a promising and glowing thing as he
held her hand and tried not to sound too insistently affectionate.
“Such a pleasure to meet you, Sister Lulu.”
Lulu was nineteen or twenty. She had a diminutive class of
twelve-year-old boys in the Sunday School. Elmer had intended to
sneak out during Sunday School, leaving Frank Shallard
responsible, and find a place where he could safely smoke a
Pittsburgh stogie, but in view of this new spiritual revelation he hung
about, beaming with holy approbation of the good work and being
manly and fraternal with the little boys in Lulu’s class.
“If you want to grow up and be big fellows, regular sure-enough
huskies, you just listen to what Miss Bains has to tell you about how
Solomon built that wonderful big ole temple,” he crooned at them;
and if they twisted and giggled in shyness, at least Lulu smiled at
him . . . gray-and-white kitten with sweet kitten eyes . . . small soft
kitten who purred, “Oh, now, Brother Gantry, I’m just so scared I
don’t hardly dare teach” . . . big eyes that took him into their depths,
till he heard her lisping as the voice of angels, larks, and whole
orchestras of flutes.
He could not let her go at the end of Sunday School. He must
hold her—
“Oh, Sister Lulu, come see the hand-car Frank and I—Brother
Shallard and I—came down on. The fun-niest! Just laugh your head
off!”
As the section gang passed through Schoenheim at least ten
times a week, hand-cars could have been no astounding novelty to
Lulu, but she trotted beside him, and stared prettily, and caroled,
“Oh, hon-est! Did you come down on that? Well, I never!”
She shook hands cheerfully with both of them. He thought
jealously that she was as cordial to Frank as to himself.
“He better watch out and not go fooling round my girl!” Elmer
reflected, as they pumped back toward Babylon.
He did not congratulate Frank on having overcome his dread of
stolid country audiences (Frank had always lived in cities) or on
having made Solomon’s temple not merely a depressing object
composed of a substance called “cubits” but an actual shrine in
which dwelt an active and terrifying god.
III
For two Sundays now Elmer had striven to impress Lulu not only
as an efficient young prophet but as a desirable man. There were
always too many people about. Only once did he have her alone.
They walked half a mile then to call on a sick old woman. On their
way Lulu had fluttered at him (gray-and-white kitten in a close bonnet
of soft fuzzy gray, which he wanted to stroke).
“I suppose you’re just bored to death by my sermons,” he fished.
“Oh, nnnno! I think they’re just wonderful!”
“Do you, honest?”
“Honest, I do!”
He looked down at her childish face till he had caught her eyes,
then, jocularly:
“My, but this wind is making the little cheeks and the cute lips
awful’ red! Or I guess maybe some fella must of been kissing ’em
before church!”
“Oh, no—”
She looked distressed, almost frightened.
“Whoa up!” he counseled himself. “You’ve got the wrong track.
Golly, I don’t believe she’s as much of a fusser as I thought she was.
Really is kinda innocent. Poor kid, shame to get her all excited. Oh,
thunder, won’t hurt her a bit to have a little educated love-making!”
He hastily removed any possible blots on his clerical reputation:
“Oh, I was joking. I just meant—be a shame if as lovely a girl as
you weren’t engaged. I suppose you are engaged, of course?”
“No. I liked a boy here awfully, but he went to Cleveland to work,
and I guess he’s kind of forgotten me.”
“Oh, that is really too bad!”
Nothing could be stronger, more dependable, more comforting,
than the pressure of his fingers on her arm. She looked grateful; and
when she came to the sick-room and heard Brother Gantry pray,
long, fervently, and with the choicest words about death not really
mattering nor really hurting (the old woman had cancer) then Lulu
also looked worshipful.
On their way back he made his final probe:
“But even if you aren’t engaged, Sister Lulu, I’ll bet there’s a lot of
the young fellows here that’re crazy about you.”
“No, honest there aren’t. Oh, I go round some with a second
cousin of mine—Floyd Naylor—but, my! he’s so slow, he’s no fun.”
The Rev. Mr. Gantry planned to provide fun.
IV
Elmer and Frank had gone down on Saturday afternoon to
decorate the church for the Thanksgiving service. To save the trip to
Babylon and back, they were to spend Saturday night in the broad
farmhouse of Deacon Bains, and Lulu Bains and her spinster cousin,
Miss Baldwin, were assisting in the decoration—in other words doing
it. They were stringing pine boughs across the back of the hall, and
arranging a harvest feast of pumpkins, yellow corn, and velvety
sumach in front of the pulpit.
While Frank and the spinster cousin of the Bainses discussed the
artistic values of the pumpkins, Elmer hinted to Lulu:
“I want your advice, Lulu—Sister Lulu. Don’t you think in my
sermon tomorrow it might be helpful to explain—”
(They stood side by side. How sweet were her little shoulders,
her soft pussy-cat cheeks! He had to kiss them! He had to! He
swayed toward her. Damn Frank and that Baldwin female! Why
didn’t they get out?)
“—to explain that all these riches of the harvest, priceless though
they are in themselves and necessary for grub—for the festal board,
yet they are but symbols and indications of the—Do sit down, Lulu;
you look a little tired.—of the deeper spiritual blessings which he also
showers on us and not just at harvest time, and this is a very
important point—”
(Her hand dropped against his knee; lay, so white, on the drab
pew. Her breasts were young and undrained under her plaid blouse.
He had to touch her hand. His fingers crept toward it, touched it by
accident, surely by accident, while she looked devotion and he
intoned sublimity.)
“—a very important point indeed; all the year round we receive
those greater inner blessings, and it is for them more than for any
material, uh, material gains that we should lift our voices in
Thanksgiving. Don’t you think it might be valuable to all of us if I
brought that out?”
“Oh, yes! Indeed I do! I think that’s a lovely thought!”
(His arms tingled. He had to slip them about her.)
Frank and Miss Baldwin had sat down, and they were in an
intolerably long discussion as to what ought to be done about that
terrible little Cutler boy who said that he didn’t believe that the ravens
brought any bread and meat to Elijah, not if he knew anything about
these ole crows! Frank explained that he did not wish to rebuke
honest doubt; but when this boy went and made a regular business
of cutting up and asking foolish questions—
“Lulu!” Elmer urged. “Skip back in the other room with me a
second. There’s something about the church work I want to ask you,
and I don’t want them to hear.”
There were two rooms in the Schoenheim church: the auditorium
and a large closet for the storage of hymn books, mops, brooms,
folding chairs, communion cups. It was lighted by a dusty window.
“Sister Bains and I are going to look over the Sunday School
lesson-charts,” Elmer called largely and brightly.
The fact that she did not deny it bound them together in secrecy.
He sat on an upturned bucket; she perched on a step-ladder. It was
pleasant to be small in her presence and look up to her.
What the “something about church work” which he was going to
ask her was, he had no notion, but Elmer was a very ready talker in
the presence of young women. He launched out:
“I need your advice. I’ve never met anybody that combined
common sense and spiritual values like what you do.”
“Oh, my, you’re just flattering me, Brother Gantry!”
“No, I’m not. Honest, I ain’t! You don’t appreciate yourself. That’s
because you’ve always lived in this little burg, but if you were in
Chicago or some place like that, believe me, they’d appreciate your,
uh, that wonderful sense of spiritual values and everything.”
“Oh—Chicago! My! I’d be scared to death!”
“Well, I’ll have to take you there some day and show you the
town! Guess folks would talk about their bad old preacher then!”
They both laughed heartily.
“But seriously, Lulu, what I want to know is—uh— Oh! What I
wanted to ask you: Do you think I ought to come down here and hold
Wednesday prayer-meetings?”
“Why, I think that’d be awfully nice.”
“But, you see, I’d have to come down on that ole hand-car.”
“That’s so.”
“And you can’t know how hard I got to study every evening at the
Seminary.”
“Oh, yes, I can imagine!”
They both sighed in sympathy, and he laid his hand on hers, and
they sighed again, and he removed his hand almost prudishly.
“But of course I wouldn’t want to spare myself in any way. It’s a
pastor’s privilege to spend himself for his congregation.”
“Yes, that’s so.”
“But on the other hand, with the roads the way they are here,
especially in winter and all, and most of the congregation living way
out on farms and all—hard for ’em to get in, eh?”
“That’s so. The roads do get bad. Yes, I think you’re right, Brother
Gantry.”
“Oh! Lulu! And here I’ve been calling you by your first name!
You’re going to make me feel I been acting terrible if you rebuke me
that way and don’t call me Elmer!”
“But then you’re the preacher, and I’m just nobody.”
“Oh, yes, you are!”
“Oh, no, I’m not!”
They laughed very much.
“Listen, Lulu, honey. Remember I’m really still a kid—just twenty-
five this month—only ’bout five or six years older’n you are. Now try
calling me Elmer, and see how it sounds.”
“Oh, my! I wouldn’t dare!”
“Well, try it!”
“Oh, I couldn’t! Imagine!”
“ ’Fraid cat!”
“I am not so.”
“Yes, you are!”
“No, I’m not!”
“I dare you!”
“Well—Elmer, then! So there now!”
They laughed intimately, and in the stress of their merriment he
picked up her hand, squeezed it, rubbed it against his arm. He did
not release it, but it was only with the friendliest and least emphatic
pressure that he held it while he crooned:
“You aren’t really scared of poor old Elmer?”
“Yes, I am, a tiny bit!”
“But why?”
“Oh, you’re big and strong and dignified, like you were lots older,
and you have such a boom-boom voice—my, I love to listen to it, but
it scares me—I feel like you’d turn on me and say, ‘You bad little girl,’
and then I’d have to ’fess. My! And then you’re so terribly educated
—you know such long words, and you can explain all these things
about the Bible that I never can understand. And of course you are a
real ordained Baptist clergyman.”
“Um, uh— But does that keep me from being a man, too?”
“Yes, it does! Sort of!”
Then there was no playfulness, but a grim urgency in his voice:
“Then you couldn’t imagine me kissing you? . . . Look at me! . . .
Look at me, I tell you! . . . There! . . . No, don’t look away now. Why,
you’re blushing! You dear, poor, darling kid! You can imagine me
kissing—”
“Well, I oughtn’t to!”
“ ’Shamed?”
“Yes, I am!”
“Listen, dear. You think of me as so awfully grown-up, and of
course I have to impress all these folks when I’m in the pulpit, but
you can see through it and— I’m really just a big bashful kid, and I
need your help so. Do you know, dear, you remind me of my mother
—”
V
Frank Shallard turned on Elmer in their bedroom, while they were
washing for supper—their first moment alone since Lulu and Miss
Baldwin had driven them to the Bains farm to spend the night before
the Thanksgiving service.
“Look here, Gantry—Elmer. I don’t think it looked well, the way
you took Miss Bains in the back room at the church and kept her
there—must have been half an hour—and when I came in you two
jumped and looked guilty.”
“Uh-huh, so our little friend Franky is a real rubber-necking old
woman!”
It was a spacious dusky cavern under the eaves, the room where
they were to stay the night. The pitcher on the black walnut
washstand was stippled in gold, riotous with nameless buds. Elmer
stood glaring, his big forearms bare and dripping, shaking his fingers
over the carpet before he reached for the towel.
“I am not a ‘rubber-neck,’ and you know it, Gantry. But you’re the
preacher here, and it’s our duty, for the effect on others, to avoid
even the appearance of evil.”
“Evil to him that evil thinks. Maybe you’ve heard that, too!”
“Oh, yes, Elmer, I think perhaps I have!”
“Suspicious, dirty-minded Puritan, that’s what you are, seeing evil
where there ain’t any meant.”
“People don’t hate Puritans because they suspect unjustly, but
because they suspect only too darned justly. Look here now, Elmer. I
don’t want to be disagreeable—”
“Well, you are!”
“—but Miss Bains—she looks sort of cuddlesome and flirtatious,
but I’m dead certain she’s straight as can be, and I’m not going to
stand back and watch you try to, uh, to make love to her.”
“Well, smarty, suppose I wanted to marry her?”
“Do you?”
“You know so blame’ much, you ought to know without asking!”
“Do you?”
“I haven’t said I didn’t.”
“Your rhetoric is too complicated for me. I’ll take it that you do
mean to. That’s fine! I’ll announce your intentions to Deacon Bains.”
“You will like hell! Now you look here, Shallard! I’m not going to
have you poking your long nose into my business, and that’s all
there is to it, see?”
“Yes, it would be if you were a layman and I had no official
connection with this outfit. I don’t believe too much in going around
being moral for other people. But you’re the preacher here—you’re
an ordained minister—and I’m responsible with you for the welfare of
this church, and I’m damned if I’m going to watch you seducing the
first girl you get your big sweaty hands on— Oh, don’t go doubling
up your fists. Of course you could lick me. But you won’t. Especially
here in the deacon’s house. Ruin you in the ministry. . . . Great God,
and you’re the kind we affably let into the Baptist ministry! I was
saying: I don’t propose to see you trying to seduce—”
“Now, by God, if you think I’m going to stand— Let me tell you
right now, you’ve got the filthiest mind I ever heard of, Shallard! Why
you should think I intend for one single second to be anything but
friendly and open and aboveboard with Lulu—with Miss Bains—Why,
you fool, I was in there listening about how she was in love with a
fellow and he’s gone off to Chicago and chucked her, and that was
all, and why you should think—”
“Oh, don’t be so fat-headed, Gantry! You can’t get away with
sitting in my room at the Sem boasting, you and Zenz boasting about
how many affairs you’ve had—”
“Well, it’s the last time I’ll sit in your damned room!”
“Splendid!”
“Think what you want to. And go to the devil! And be sure and run
tattling to Pop Trosper and the rest of the faculty!”
“Well, that’s a good come-back, Gantry. I may do just that. But
this evening I’ll just watch Lulu—watch Miss Bains and you. Poor
sweet kid that she is! Nice eyes!”
“Uh-huh, young Shallard, so you’ve been smelling around, too!”
“My God, Gantry, what a perfect specimen you are!”
VI
Deacon and Mrs. Bains—an angry-faced, generous, grasping,
horsy, black-mustached man he was, and she a dumpling—
managed to treat Frank and Elmer simultaneously as professors of
the sacred mysteries and as two hungry boys who were starved at
Mizpah and who were going to catch up tonight. Fried chicken,
creamed chipped beef, homemade sausages, pickles, and mince pie
in which Elmer suspected, and gratefully suspected, the presence of
unrighteous brandy, were only part of the stout trencher-work
required of the young prophets. Mr. Bains roared every three
minutes at the swollen and suffering Frank, “Nonsense, nonsense,
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.
textbookfull.com