## An Interdisciplinary Introduction to Image Processing

by Tanimoto

### Instructor Requests

Basic principles of image processing and programming explained without college-level mathematics.

This book explores image processing from several perspectives: the creative, the theoretical (mainly mathematical), and the programmatical. It explains the basic principles of image processing, drawing on key concepts and techniques from mathematics, psychology of perception, computer science, and art, and introduces computer programming as a way to get more control over image processing operations. It does so without requiring college-level mathematics or prior programming experience. The content is supported by PixelMath, a freely available software program that helps the reader understand images as both visual and mathematical objects.

The first part of the book covers such topics as digital image representation, sampling, brightness and contrast, color models, geometric transformations, synthesizing images, stereograms, photomosaics, and fractals. The second part of the book introduces computer programming using an open-source version of the easy-to-learn Python language. It covers the basics of image analysis and pattern recognition, including edge detection, convolution, thresholding, contour representation, and K-nearest-neighbor classification. A chapter on computational photography explores such subjects as high-dynamic-range imaging, autofocusing, and methods for automatically inpainting to fill gaps or remove unwanted objects in a scene. Applications described include the design and implementation of an image-based game.

The PixelMath software provides a “transparent” view of digital images by allowing the user to view the RGB values of pixels by zooming in on an image. PixelMath provides three interfaces: the pixel calculator; the formula page, an advanced extension of the calculator; and the Python window.

Expand/Collapse All
Contents (pg. v)
Preface (pg. xvii)
Acknowledgments (pg. xxi)
I IMAGES AND FORMULAS (pg. 1)
1 Introduction (pg. 3)
1.1 Sources of Images (pg. 3)
1.2 What Is an Image? (pg. 4)
1.3 What Is a Pixel? (pg. 5)
1.4 What Is a Function? (pg. 7)
1.5 What Is a Program? (pg. 9)
1.6 Human Vision (pg. 9)
1.7 How Does a Digital Camera Work? (pg. 17)
1.8 What Can We Do with All These Pixels? (pg. 18)
1.9 References (pg. 19)
1.10 Exercises (pg. 19)
2 Getting Started (pg. 21)
2.1 Representation of Digital Images (pg. 21)
2.2 Starting PixelMath (pg. 31)
2.3 Examining Your Image (pg. 31)
2.4 Put a Twinkle in Your Eye (pg. 36)
2.5 A Quick Overview of Features (pg. 37)
2.6 References (pg. 37)
2.7 Exercises (pg. 37)
3 Brightness and Contrast (pg. 41)
3.1 Brightness (pg. 41)
3.2 Contrast (pg. 43)
3.3 Histograms (pg. 44)
3.4 Thresholding (pg. 47)
3.5 Quantization (pg. 49)
3.6 Bits and Bytes (pg. 51)
3.7 The Memory Required by an Image (pg. 53)
3.8 References (pg. 53)
3.9 Exercises (pg. 53)
4 Controlling Color (pg. 55)
4.1 The Phenomenon of Color (pg. 55)
4.2 Controlling Color in PixelMath (pg. 56)
4.3 Specific Colors and Palettes (pg. 58)
4.4 Color Enhancements (pg. 64)
4.5 Specifying Color Components in Formulas (pg. 70)
4.6 Hue, Saturation, and Value (pg. 73)
4.7 Indexed Color Formats, GIF and PNG (pg. 80)
4.8 References (pg. 81)
4.9 Exercises (pg. 81)
5 Geometric Transformations (pg. 83)
5.1 Overview (pg. 83)
5.2 Scaling with One Window (pg. 83)
5.3 Push versus Pull (pg. 86)
5.4 Setting Up for Two-Window Operations (pg. 90)
5.5 Widths and Heights (pg. 90)
5.6 Reflections (pg. 91)
5.7 90-Degree Rotations (pg. 93)
5.8 Two Transformations in Succession (pg. 94)
5.9 Modular Arithmetic on Coordinates (pg. 95)
5.10 Resampling (pg. 97)
5.11 Composition of Transformations (pg. 100)
5.12 Invertibility and the Identity (pg. 101)
5.13 Closure (pg. 104)
5.14 Groups (pg. 105)
5.15 Summary (pg. 107)
6 Geometric Distortions (pg. 113)
6.1 Perturbing Coordinates (pg. 113)
6.2 Modulator Images (pg. 116)
6.3 Invertibility Once Again (pg. 123)
6.4 Polar Coordinates (pg. 125)
6.5 Angles and Radii (pg. 125)
6.6 Visualizing the Polar Coordinates (pg. 125)
6.7 Transformations with Polar Coordinates (pg. 127)
6.8 Fisheye Transformations (pg. 128)
6.9 Ripples on a Pond (pg. 130)
6.10 Polar Pixellation Effects (pg. 130)
6.11 About Anamorphic Images (pg. 132)
6.12 Definition and Motivation (pg. 132)
6.13 Obtaining a Cylindrical Mirror (pg. 133)
6.14 Slant Anamorphosis (pg. 134)
6.15 Cylinder Anamorphosis (pg. 139)
6.16 Connections (pg. 146)
6.17 Tuning Parameters (pg. 146)
6.18 References (pg. 149)
6.19 Exercises (pg. 149)
7 Synthesizing Images (pg. 153)
7.1 Rendering Points (pg. 153)
7.2 Drawing Lines (pg. 155)
7.3 Nonlinear Functions of the Form y = f(x) (pg. 159)
7.4 Other Planar Figures (pg. 163)
7.5 Functions of Form z = f(x,y) (pg. 165)
7.6 Mountain Ranges and Distance Transforms (pg. 168)
7.7 Making Curved Surfaces (pg. 170)
7.8 Exercises (pg. 171)
8 Stereograms (pg. 175)
8.1 Introduction to Stereo (pg. 175)
8.2 Traditional Stereo Pairs (pg. 175)
8.3 Autostereograms (pg. 178)
8.4 Making an Autostereogram: Basic Ideas (pg. 180)
8.5 Challenges (pg. 184)
8.6 Further Discussion (pg. 185)
8.7 References (pg. 186)
8.8 Exercises (pg. 186)
9 Images Within Images (pg. 189)
9.1 What Is Steganography? (pg. 189)
9.2 Discovering Information by Stretching Contrast (pg. 190)
9.3 Hiding Messages Using Key Values (pg. 191)
9.4 Hiding Messages Using Bitwise Exclusive-OR (pg. 194)
9.5 Hiding and Finding Messages Using Masks (pg. 195)
9.6 Scrambling and Unscrambling (pg. 198)
9.7 Watermarks (pg. 202)
9.8 Photomosaics (pg. 203)
9.9 Panorama Stitching (pg. 208)
9.10 Fractals (pg. 208)
9.11 References (pg. 214)
9.12 Exercises (pg. 215)
10 Filtering (pg. 217)
10.1 Introduction (pg. 217)
10.2 Filtering Out Noise (pg. 217)
10.3 Median Filtering (pg. 220)
10.4 High-Pass Filtering and Sharpening (pg. 220)
10.5 Convolution (pg. 223)
10.6 Systems of Filters (pg. 226)
10.7 The Discrete Cosine Transform (pg. 226)
10.8 Vectors and Vector Spaces (pg. 230)
10.9 Bases for Vector Spaces (pg. 231)
10.10 Image Vector Spaces (pg. 233)
10.11 Bases of Complex Exponentials (pg. 234)
10.12 Fourier Transforms (pg. 236)
10.13 Two-Dimensional Fourier Transforms (pg. 238)
10.14 Filtering with the Fourier Transform (pg. 238)
10.15 References (pg. 240)
10.16 Exercises (pg. 241)
II IMAGES AND PROGRAMS (pg. 245)
11 Introducing Python (pg. 247)
11.1 Why Use Programming in PixelMath? (pg. 247)
11.2 Introducing the Programming Interface (pg. 248)
11.3 Editing Sequences of Commands (pg. 250)
11.4 How to Deal with Errors in the Commands (pg. 252)
11.5 A Longer Example (pg. 253)
11.6 PixelMath Commands (pg. 254)
11.7 An Example: Twin Monas (pg. 257)
11.8 References (pg. 257)
12 Basics of Python (pg. 259)
12.1 Overview (pg. 259)
12.2 Interacting with Python (pg. 259)
12.3 Numbers (pg. 260)
12.4 Variables (pg. 261)
12.5 Arithmetic Expressions (pg. 262)
12.6 Strings (pg. 263)
12.7 Lists (pg. 265)
12.8 Built-in Functions (pg. 267)
12.9 Modules and Importing (pg. 267)
12.10 Comments in Code (pg. 269)
12.11 Example (pg. 269)
12.12 References (pg. 270)
12.13 Exercises (pg. 270)
13 Control Structures: Conditionals and Repetition (pg. 273)
13.1 Overview (pg. 273)
13.2 Conditionals (pg. 273)
13.3 Boolean Values (pg. 274)
13.4 Multiple Cases (pg. 276)
13.5 Loops (pg. 277)
13.6 Nested Loops (pg. 278)
13.7 Looping to Enlarge an Image (pg. 279)
13.8 Loops Using while (pg. 279)
13.9 Setting up Multiple Windows (pg. 282)
13.10 Building Convolution Formulas (pg. 283)
13.11 Four-Level Nesting for Median Filtering (pg. 286)
13.12 Iterative Transformations (pg. 287)
13.13 Dissolves (pg. 288)
13.14 Anatomy of a Loop (pg. 289)
13.15 Progressive Scrambling (pg. 290)
13.16 Handling Exceptions (pg. 292)
13.17 Exercises (pg. 293)
14 Data Structures (pg. 295)
14.1 Overview (pg. 295)
14.2 Strings (pg. 295)
14.3 Lists (pg. 300)
14.4 Tuples (pg. 302)
14.5 Dictionaries (pg. 303)
14.6 Classes (pg. 306)
14.7 Trees (pg. 311)
14.8 Graphs (pg. 315)
14.9 References (pg. 316)
14.10 Exercises (pg. 316)
15 Creating Functions (pg. 321)
15.1 Encapsulating Sequences of Operations (pg. 321)
15.2 Defining Simple Python Functions (pg. 322)
15.3 Functions with Parameters (pg. 323)
15.4 Software Engineering with Functions (pg. 324)
15.5 Returned Values versus Side Effects (pg. 326)
15.6 Parameter List Options (pg. 327)
15.7 Recursive Functions (pg. 329)
15.8 Functional Programming Techniques (pg. 339)
15.9 References (pg. 344)
15.10 Exercises (pg. 344)
16 Programming Techniques (pg. 349)
16.1 Overview (pg. 349)
16.2 Concepts and Paradigms (pg. 349)
16.3 Imperative Programming (pg. 351)
16.4 Object-Oriented Programming (pg. 351)
16.5 Functional Programming (pg. 351)
16.6 Callable Objects (pg. 352)
16.7 A Three-Paradigm Presentation (pg. 353)
16.8 Some Details About the Example (pg. 356)
16.9 Scaffolding, Testing, and Debugging (pg. 360)
16.10 Considerations for Large Projects (pg. 365)
16.11 References (pg. 366)
16.12 Exercises (pg. 366)
17 Image Analysis (pg. 367)
17.1 Overview (pg. 367)
17.2 Applications of Image Analysis (pg. 368)
17.3 Boundary Finding (pg. 368)
17.4 Contour and Line Finding (pg. 372)
17.5 Connected Components (pg. 377)
17.6 Morphology (pg. 382)
17.7 Other Features (pg. 386)
17.8 Exercises (pg. 387)
18 Pattern Recognition (pg. 393)
18.1 Overview (pg. 393)
18.2 K-Nearest-Neighbor Classification (pg. 394)
18.3 Perceptrons (pg. 398)
18.4 The K-Means Clustering Method (pg. 401)
18.5 References (pg. 404)
18.6 Exercises (pg. 404)
19 Computational Photography (pg. 407)
19.1 Overview (pg. 407)
19.2 High-Dynamic-Range Photography (pg. 407)
19.3 Automatic Focus Methods (pg. 411)
19.4 Multiple-Focus Photography (pg. 413)
19.5 Ultra-High-Resolution Photography (pg. 414)
19.7 Separating Direct and Global Illumination (pg. 416)
19.8 Image Inpainting (pg. 418)
19.9 Other Developments (pg. 424)
19.10 References (pg. 424)
19.11 Exercises (pg. 425)
20 Selected Applications (pg. 427)
20.1 Overview (pg. 427)
20.2 Morphing (pg. 427)
20.3 Photomosaics with Many Images (pg. 435)
20.4 An Image-Matching Game (pg. 445)
20.5 References (pg. 467)
20.6 Exercises (pg. 467)
APPENDIXES (pg. 471)
A Calculator Formulas (pg. 473)
B Quick Reference—PixelMath Formulas (pg. 481)
C Python Glossary (pg. 483)
D Troubleshooting (pg. 497)
E Graphical User Interfaces (pg. 499)
Index (pg. 507)

eTextbook