## Book Contents

1 Crunching Pixels

1.1 Programming with Images

1.2 Image Analysis and “Intelligent” Processing

2 Digital Images

2.1 Types of Digital Images

2.2 Image Acquisition

2.2.1 The Pinhole Camera Model

2.2.2 The “Thin” Lens

2.2.3 Going Digital

2.2.4 Image Size and Resolution

2.2.5 Image Coordinate System

2.2.6 Pixel Values

2.3 Image File Formats

2.3.1 Raster vs. Vector Images

2.3.2 Tagged Image File Format (TIFF)

2.3.3 Graphics Interchange Format (GIF)

2.3.4 Portable Network Graphics (PNG)

2.3.5 JPEG

2.3.6 Windows Bitmap (BMP)

2.3.7 Portable Bitmap Format (PBM)

2.3.8 Additional File Formats

2.3.9 Bits and Bytes

2.4 Exercises

3 ImageJ

3.1 Software for Digital Images

3.1.1 Software for Image Manipulation

3.1.2 Software for Image Processing

3.2 Properties of ImageJ

3.2.1 Features

3.2.2 Available Tools

3.2.3 ImageJ Plugins

3.2.4 An Example Plugin “inverter”

3.3 Additional Information about ImageJ and Java

3.3.1 ImageJ Resources

3.3.2 Programming with Java

3.4 Exercises

4 Histograms

4.1 What is a Histogram?

4.2 What can be discovered from a Histogram?

4.2.1 Brightness, Contrast, and Dynamic Range

4.2.2 Image Defects

4.3 Computing the Histogram

4.4 Histograms for Images with more than 8 bits

4.4.1 Binning

4.4.2 Example

4.4.3 Implementation

4.5 Histograms of Color Images

4.5.1 Intensity Histogram

4.5.2 Histogram of Individual Color Channels

4.5.3 Combined Color Histogram

4.6 Cumulative Histogram

4.7 Exercises

5 Point Operations

5.1 Changing Pixel Intensity

5.1.1 Contrast and Brightness

5.1.2 Clamping

5.1.3 Automatic Contrast Enhancement

5.1.4 Inverting Images

5.1.5 Thresholding

5.1.6 Point Operations and Histograms

5.2 Linear Histogram Equalization

5.2.1 Histogram Specification

5.3 Gamma Correction

5.3.1 Why Gamma?

5.3.2 The Gamma Function

5.3.3 Real Gamma Values

5.3.4 Applying Gamma Correction

5.3.5 Implementation

5.3.6 Gamma Function with Offset

5.4 Point Operations in ImageJ

5.4.1 Point Operations with Look-up Tables

5.4.2 Standard Arithmetic Operations

5.4.3 Point Operations with Multiple Images

5.4.4 ImageJ Plugins for Multiple Images

5.5 Exercises

6 Filters

6.1 What is a Filter?

6.2 Linear Filters

6.2.1 The Filter Matrix

6.2.2 Using Filters

6.2.3 Computing Filter Operations

6.2.4 Filter Plugin Example

6.2.5 Integer Coefficients

6.2.6 Arbitrary Size Filters

6.2.7 Types of Linear Filters

6.3 Formal Properties of Linear Filters

6.3.1 Linear Convolution

6.3.2 Properties of Linear Convolution

6.3.3 Separability of Filters

6.3.4 Impulse Response

6.4 Non-linear Filters

6.4.1 Minimum- and Maximum-Filter

6.4.2 Median Filter

6.4.3 The Weighted Median Filter

6.4.4 Additional Non-linear Filters

6.5 Filter Implementation

6.5.1 Efficiency of Filter Programs

6.5.2 Handling Image Borders

6.6 Filter Operations in ImageJ

6.6.1 Linear Filters

6.6.2 Gaussian Filters

6.6.3 Non-linear Filters

6.7 Exercises

7 Edges and Contours

7.1 How do Edges Arise

7.2 Gradient Based Edge Detection

7.2.1 Partial Derivatives and the Gradient

7.2.2 Derivative Filters

7.3 Filters for Edge Detection

7.3.1 Prewitt and Sobel Operators

7.3.2 Roberts Operator

7.3.3 Compass Operators

7.3.4 Edge Operators in ImageJ

7.4 Additional Edge Operators

7.4.1 Edge Detection with Second Derivatives

7.4.2 Edges at Different Scales

7.4.3 Canny Filter

7.5 From Edges to Contours

7.5.1 Contour Following

7.5.2 Edge Images

7.6 Edge Enhancement

7.6.1 Edge Enhancement using the Laplace Filter

7.6.2 Unsharp Masking

7.7 Exercises

8 Finding Points of Interest

8.1 Points of Interest

8.2 Harris Corner Detector

8.2.1 Local Structure Matrix

8.2.2 Corner Response Function (CRF)

8.2.3 Determining Corner Points

8.2.4 Example

8.3 Implementation

8.3.1 Step 1 – Computing the Corner Response Function

8.3.2 Step 2 – Determining the Corner Points

8.3.3 Displaying the Corner Points

8.3.4 Summary

8.4 Exercises

9 Detecting Simple Curves

9.1 Salient Structures

9.2 Hough Transform

9.2.1 Parameter Spaces

9.2.2 Accumulator Array

9.2.3 A Better Representation for Lines

9.3 Implementing the Hough Transform

9.3.1 Filling the Accumulator Array

9.3.2 Analyzing the Accumulator Array

9.3.3 Extensions to the Hough Transform

9.4 Hough Transforms for Circles and Ellipses

9.4.1 Circles and Arcs

9.4.2 Ellipses

9.5 Exercises

10 Morphological Filters

10.1 Shrinking and Growing

10.1.1 Image Neighborhoods

10.2 Basic Morphological Operations

10.2.1 The Structuring Element

10.2.2 Point Sets

10.2.3 Dilation

10.2.4 Erosion

10.2.5 Properties of Dilation and Erosion

10.2.6 Design of Morphological Filters

10.2.7 Example Usage: Outlining

10.3 Composite Operations

10.3.1 Opening

10.3.2 Closing

10.3.3 Properties of Opening and Closing

10.4 Morphological Filters for Grayscale and Color Images

10.4.1 Structuring Elements

10.4.2 Grayscale Dilation and Erosion

10.4.3 Grayscale Opening and Closing

10.5 Implementing Morphological Filters

10.5.1 Binary Images in ImageJ

10.5.2 Dilation and Erosion

10.5.3 Opening and Closing

10.5.4 Outlining

10.5.5 Morphological Operations in ImageJ

10.6 Exercises

11 Regions in Binary Images

11.1 Finding Image Regions

11.1.1 Region Marking with Flood Filling

11.1.2 Sequential Region Marking

11.1.3 Region Marking – Summary

11.2 Region Contours

11.2.1 Internal and External Contours

11.2.2 Combining Region Marking and Contour Finding

11.2.3 Implementation

11.2.4 Example

11.3 Representing Image Regions

11.3.1 Matrix Representation

11.3.2 Run Length Encoding

11.3.3 Chain Codes

11.4 Properties of Binary Regions

11.4.1 Shape Features

11.4.2 Geometric Properties

11.4.3 Statistical Shape Properties

11.4.4 Moment Based Geometrical Properties

11.4.5 Projections

11.4.6 Topological Properties

11.5 Exercises

12 Color Images

12.1 RGB Color Images

12.1.1 Organization of Color Images

12.1.2 Color Images in ImageJ

12.2 Color Spaces and Color Conversion

12.2.1 Conversion to Grayscale

12.2.2 Color Image De-saturation

12.2.3 HSV/HSB and HLS Color Spaces

12.2.4 TV Component Color Spaces – YUV, YIQ, YC_{b}C_{r}

12.2.5 Color Space for Printing – CMY and CMYK

12.3 Colorimetric Color Spaces

12.3.1 CIE Color Space

12.3.2 CIE L^{*}a^{*}b^{*}

12.3.3 sRGB

12.3.4 Adobe RGB

12.3.5 Colors and Color Spaces in Java

12.4 Color Image Statistics

12.4.1 How many Colors are in an Image?

12.4.2 Histograms

12.5 Color Quantization

12.5.1 Scalar Color Quantization

12.5.2 Vector Quantization

12.6 Exercises

13 Introduction to Spectral Techniques

13.1 The Fourier Transform

13.1.1 Sine and Cosine Functions

13.1.2 Representing Periodic Functions with Fourier Series

13.1.3 The Fourier Transform

13.1.4 Fourier Transform Pairs

13.1.5 Important Properties of the Fourier Transform

13.2 Transition to Discrete Data

13.2.1 Sampling

13.2.2 Discrete and Periodic Functions

13.3 The Discrete Fourier Transform (DFT)

13.3.1 Definition of the DFT

13.3.2 Discrete Basis Functions

13.3.3 Yet Again Aliasing!

13.3.4 Units in Spatial and Spectral Spaces

13.3.5 The Power Spectrum

13.4 Implementation of the DFT

13.4.1 Direct Implementation

13.4.2 Fast Fourier Transform (FFT)

13.5 Exercises

14 The Discrete Fourier Transform in 2D

14.1 Definition of the 2D DFT

14.1.1 2D Basis Functions

14.1.2 Implementing the 2D DFT

14.2 Representing the Fourier Transform in 2D

14.2.1 Range of Values

14.2.2 Centered Representation

14.3 Frequency and Orientation in 2D

14.3.1 Effective Frequency

14.3.2 Frequency Limits and Aliasing in 2D

14.3.3 Orientation

14.3.4 Geometric Correction of the 2D Spectrum

14.3.5 Effects of Periodicity

14.3.6 Windowing

14.3.7 Windowing Functions

14.4 2D Fourier Transform Examples

14.5 Properties of the DFT

14.5.1 Linear Filter Operations in the Spectral Domain

14.5.2 Linear Convolution and Correlation

14.5.3 Inverse Filters

14.6 Exercises

15 The Discrete Cosine Transform (DCT)

15.1 One Dimensional DCT

15.1.1 DCT Basis Functions

15.1.2 Implementing the One Dimensional DCT

15.2 Two Dimensional DCT

15.2.1 Separability

15.2.2 Example

15.3 Additional Spectral Transformations

15.4 Exercises

16 Geometrical Image Operations

16.1 Coordinate Transformations in 2D

16.1.1 Simple Transformations

16.1.2 Homogeneous Coordinates

16.1.3 Affine Transformations (Three Point Transformations)

16.1.4 Projective Transformations (Four Point Transformations)

16.1.5 Bilinear Transformations

16.1.6 Additional Non-Linear Image Deformations

16.2 Re-Sampling

16.2.1 Source-to-Target Mapping

16.2.2 Target-to-Source Mapping

16.3 Interpolation

16.3.1 Simple Interpolation Methods

16.3.2 Ideal Interpolation

16.3.3 Interpolation Using Convolution

16.3.4 Cubic Interpolation

16.3.5 Interpolation in 2D

16.3.6 Aliasing

16.4 Java Implementation

16.4.1 Geometrical Transformations

16.4.2 Pixel Interpolation

16.4.3 Usage Example

16.5 Exercises

17 Image Comparison

17.1 Template Matching in Intensity Images

17.1.1 Distance between Image Patterns

17.1.2 Dealing with Rotation and Scale Changes

17.1.3 Implementation

17.2 Comparison of Binary Images

17.2.1 Direct Comparison of Binary Images

17.2.2 The Distance Transform

17.2.3 Chamfer Matching

17.3 Exercises

A Mathematical Notation

A.1 Often Used Symbols

A.2 Complex Numbers C

A.3 Algorithmic Complexity and *O* Notation

B Java Notes

B.1 Arithmetic

B.1.1 Integer Division

B.1.2 Modulus Operator

B.1.3 Unsigned Bytes

B.1.4 Mathematical Functions (`Math`-Class)

B.1.5 Rounding

B.1.6 Inverse Tangent Function

B.1.7 `Float` and `Double` (Classes)

B.2 Arrays in Java

B.2.1 Creating Arrays

B.2.2 Size of Arrays

B.2.3 Access to Array Elements

B.2.4 Two Dimensional Arrays

C ImageJ Short Reference

C.1 Installation and Setup

C.2 ImageJ API

C.2.1 Images (Package `ij`)

C.2.2 Image Processing (Package `ij.process`)

C.2.3 Plugins (Packages `ij.plugin`, `ij.plugin.filter`)

C.2.4 GUI Classes (Package `ij.gui`)

C.2.5 Window Management (Package `ij`)

C.2.6 Utility Classes (Package `ij`)

C.2.7 Input-Output (Package `ij.io`)

C.3 Image and Image Stacks Creation

C.3.1 `ImagePlus` (Class)

C.3.2 `ImageStack` (Class)

C.3.3 `NewImage` (Class)

C.3.4 `ImageProcessor` (Class)

C.4 Image Processor Creation

C.4.1 `ImageProcessor` (Class)

C.4.2 `ByteProcessor` (Class)

C.4.3 `ColorProcessor` (Class)

C.4.4 `FloatProcessor` (Class)

C.4.5 `ShortProcessor` (Class)

C.5 Image Parameters

C.5.1 `ImageProcessor` (Class)

C.6 Accessing Pixels

C.6.1 `ImageProcessor` (Class)

C.7 Converting from Images

C.7.1 `ImageProcessor` (Class)

C.7.2 `ImagePlus`, `ImageConverter` (Classes)

C.8 Histogram and Image Statistics

C.8.1 `ImageProcessor` (Class)

C.9 Point Operations

C.9.1 `ImageProcessor` (Class)

C.9.2 `Blitter` (Interface)

C.10 Filter

C.10.1 `ImageProcessor` (Class)

C.11 Geometrical Operations

C.11.1 `ImageProcessor` (Class)

C.12 Graphical Operations on Images

C.12.1 `ImageProcessor` (Class)

C.13 Displaying Images

C.13.1 `ImagePlus` (Class)

C.14 Image Stack Operations

C.14.1 `ImagePlus` (Class)

C.14.2 `ImageStack` (Class)

C.14.3 Stack Example

C.15 Region of Interest (ROI)

C.15.1 `ImageProcessor` (Class)

C.15.2 `ImageStack` (Class)

C.15.3 `ImagePlus` (Class)

C.15.4 `Roi`, `Line`, `OvalRoi`, `PolygonRoi` (Classes)

C.16 Image Properties

C.16.1 `ImagePlus` (Class)

C.17 Interaction

C.17.1 `IJ` (Class)

C.17.2 `ImageProcessor` (Class)

C.17.3 `GenericDialog` (Class)

C.18 Plugins

C.18.1 `PlugIn`(Interface)

C.18.2 `PlugInFilter`(Interface)

C.18.3 Executing Plugins

C.19 Window Management

C.19.1 `WindowManager` (Class)

C.20 Additional Functions

C.20.1 `ImagePlus` (Class)

C.20.2 `IJ` (Class)

D Source Code

D.1 Harris Corner Detector

D.1.1 File `Corner.java`

D.1.2 File `HarrisCornerDetector.java`

D.1.3 File `HarrisCornerPlugin_.java`

D.2 Combined Region Marking and Contour Following

D.2.1 File `ContourTracingPlugin_.java`

D.2.2 File `Node.java`

D.2.3 File `Contour.java`

D.2.4 File `OuterContour.java`

D.2.5 File `InnerContour.java`

D.2.6 File `ContourSet.java`

D.2.7 File `ContourTracer.java`

D.2.8 File `ContourOverlay.java`

hmm…. think twice? think trice? hahah?may be i should find in torrent for this book ..ngeh2