digital image processing and analysis...preface xv acknowledgments xix author xxi. section i...

11
DIGITAL IMAGE PROCESSING AND ANALYSIS Human and Computer Vision Applications with CVIPtools SECOND EDITION SCOTT E UMBAUGH Uffi\ CRC Press Taylor &. Francis Group Boca Raton London New York CRC Press is an imprint of the Taylor & Francis Group, an informa business

Upload: others

Post on 11-Aug-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DIGITAL IMAGE PROCESSING AND ANALYSIS...Preface xv Acknowledgments xix Author xxi. Section I Introduction to Digital Image Processing and Analysis. 1. Digital Image Processing and

DIGITAL IMAGE PROCESSING AND ANALYSIS Human and Computer Vision Applications with CVIPtools

SECOND EDITION

SCOTT E UMBAUGH

Uffi\ CRC Press Taylor &. Francis Group

Boca Raton London New York

CRC Press is an imprint of the Taylor & Francis Group, an informa business

Page 2: DIGITAL IMAGE PROCESSING AND ANALYSIS...Preface xv Acknowledgments xix Author xxi. Section I Introduction to Digital Image Processing and Analysis. 1. Digital Image Processing and

Contents

Preface xv Acknowledgments xix Author xxi

Section I Introduction to Digital Image Processing and Analysis

1. Digital Image Processing and Analysis 3 1.1 Overview 3 1.2 Image Analysis and Computer Vision 5 1.3 Image Processing and Human Vision 8 1.4 Key Points 12 Exercises 13 References 13 Further Reading 14

2. Computer Imaging Systems 15 2.1 Imaging Systems Overview 15 2.2 Image Formation and Sensing 20

2.2.1 Visible Light Imaging 21 2.2.2 Imaging outside the Visible Range of the EM Spectrum 28 2.2.3 Acoustic Imaging 30 2.2.4 Electron Imaging 32 2.2.5 Laser Imaging 33 2.2.6 Computer-Generated Images 34

2.3 CVIPtools Software 34 2.3.1 Main Window 37 2.3.2 Image Viewer 39 2.3.3 Analysis Window 39 2.3.4 Enhancement Window 42 2.3.5 Restoration Window 42 2.3.6 Compression Window 43 2.3.7 Utilities Window 44 2.3.8 Help Window 46 2.3.9 Development Tools 46

2.4 Image Representation 50 2.4.1 Binary Images 50 2.4.2 Gray-Scale Images 51 2.4.3 Color Images 52 2.4.4 Multispectral Images 61 2.4.5 Digital Image File Formats 62

2.5 Key Points 65

v

Page 3: DIGITAL IMAGE PROCESSING AND ANALYSIS...Preface xv Acknowledgments xix Author xxi. Section I Introduction to Digital Image Processing and Analysis. 1. Digital Image Processing and

vi Contents

Exercises 68 Problems 68 Programming Exercises 70

Supplementary Exercises 70 Supplementary Problems 70 Supplementary Programming Exercises 71

References 72 Further Reading 73

Section II Digital Image Analysis and Computer Vision

3. Introduction to Digital Image Analysis 77 3.1 Introduction 77

3.1.1 Overview 77 3.1.2 System Model 78

3.2 Preprocessing 79 3.2.1 Region of Interest Image Geometry 79 3.2.2 Arithmetic and Logic Operations 85 3.2.3 Spatial Filters 91 3.2.4 Image Quantization 95

3.3 Binary Image Analysis 104 3.3.1 Basic Image Thresholding 105 3.3.2 Connectivity and Labeling 109 3.3.3 Basic Binary Object Features I l l 3.3.4 Binary Object Classification 115

3.4 Key Points 125 Exercises 129

Problems 129 Programming Exercises 132

Supplementary Exercises 134 Supplementary Problems 134 Supplementary Programming Exercises 135

References 137 Further Reading 138

4. Segmentation and Edge/Line Detection 139 4.1 Introduction and Overview 139 4.2 Edge/Line Detection 140

4.2.1 Gradient Operators 144 4.2.2 Compass Masks 147 4.2.3 Advanced Edge Detectors 148 4.2.4 Edges in Color Images 159 4.2.5 Edge Detector Performance 164 4.2.6 Hough Transform 176

4.2.6.1 CVIPtools Parameters for the Hough Transform 185 4.2.7 Corner Detection 185

Page 4: DIGITAL IMAGE PROCESSING AND ANALYSIS...Preface xv Acknowledgments xix Author xxi. Section I Introduction to Digital Image Processing and Analysis. 1. Digital Image Processing and

Contents vii

4.3 Segmentation 188 4.3.1 Region Growing and Shrinking 190 4.3.2 Clustering Techniques 195 4.3.3 Boundary Detection 203 4.3.4 Combined Segmentation Approaches 210 4.3.5 Morphological Filtering 211

4.4 Key Points 236 Exercises 245

Problems 245 Programming Exercises 250

Supplementary Exercises 251 Supplementary Problems 251 Supplementary Programming Exercises 254

References 255 Further Reading 256

5. Discrete Transforms 259 5.1 Introduction and Overview 259 5.2 Fourier Transform 265

5.2.1 One-Dimensional Discrete Fourier Transform 268 5.2.2 Two-Dimensional Discrete Fourier Transform 271 5.2.3 Fourier Transform Properties 274

5.2.3.1 Linearity 274 5.2.3.2 Convolution 274 5.2.3.3 Translation 275 5.2.3.4 Modulation 275 5.2.3.5 Rotation 275 5.2.3.6 Periodicity 276 5.2.3.7 Sampling and Aliasing 277

5.2.4 Displaying the Discrete Fourier Spectrum 279 5.3 Discrete Cosine Transform 282 5.4 Discrete Walsh-Hadamard Transform 287 5.5 Discrete Haar Transform 292 5.6 Principal Components Transform 292 5.7 Filtering 295

5.7.1 Lowpass Filters 296 5.7.2 Highpass Filters 299 5.7.3 Bandpass and Bandreject Filters 301

5.8 Discrete Wavelet Transform 302 5.9 Key Points 315 Exercises 322

Problems 322 Programming Exercises 329

Supplementary Exercises 330 Supplementary Problems 330 Supplementary Programming Exercises 332

References 333 Further Reading 333

Page 5: DIGITAL IMAGE PROCESSING AND ANALYSIS...Preface xv Acknowledgments xix Author xxi. Section I Introduction to Digital Image Processing and Analysis. 1. Digital Image Processing and

6. Feature Analysis and Pattern Classification 335 6.1 Introduction and Overview 335 6.2 Feature Extraction 336

6.2.1 Shape Features 337 6.2.2 Histogram Features 341 6.2.3 Color Features 347 6.2.4 Spectral Features 347 6.2.5 Texture Features 349 6.2.6 Feature Extraction with CVIPtools 354

6.3 Feature Analysis 357 6.3.1 Feature Vectors and Feature Spaces 357 6.3.2 Distance and Similarity Measures 359 6.3.3 Data Preprocessing 364

6.4 Pattern Classification 368 6.4.1 Algorithm Development: Training and Testing Methods 368 6.4.2 Classification Algorithms and Methods 370 6.4.3 Cost/Risk Functions and Success Measures 373 6.4.4 Pattern Classification with CVIPtools 376

6.5 Key Points 378 Exercises 387

Problems 387 Programming Exercises 391

Supplementary Exercises 395 Supplementary Problems 395 Supplementary Programming Exercises 397

References 398 Further Reading 399

Section HI Digital Image Processing and Human Vision

7. Digital Image Processing and Visual Perception 403 7.1 Introduction and Overview 403 7.2 Human Visual Perception 403

7.2.1 Human Visual System 404 7.2.2 Spatial Frequency Resolution 410 7.2.3 Brightness Adaptation 415 7.2.4 Temporal Resolution 419 7.2.5 Perception and Illusion 421

7.3 Image Fidelity Criteria 421 7.3.1 Objective Fidelity Measures 423 7.3.2 Subjective Fidelity Measures 425

7.4 Key Points 432 Exercises 436

Problems 436 Programming Exercises 439

Supplementary Exercises 439 Supplementary Problems 439 Supplementary Programming Exercises 440

Page 6: DIGITAL IMAGE PROCESSING AND ANALYSIS...Preface xv Acknowledgments xix Author xxi. Section I Introduction to Digital Image Processing and Analysis. 1. Digital Image Processing and

Contents ix

References 441 Further Reading 442

8. Image Enhancement 443 8.1 Introduction and Overview 443 8.2 Gray-Scale Modification 445

8.2.1 Mapping Equations 445 8.2.2 Histogram Modification 456 8.2.3 Adaptive Contrast Enhancement 468 8.2.4 Color 476

8.3 Image Sharpening 489 8.3.1 Highpass Filtering 490 8.3.2 High Frequency Emphasis 490 8.3.3 Directional Difference Filters 493 8.3.4 Homomorphic Filtering 494 8.3.5 Unsharp Masking 497 8.3.6 Edge Detector-Based Sharpening Algorithms 499

8.4 Image Smoothing 503 8.4.1 Frequency Domain Lowpass Filtering 503 8.4.2 Convolution Mask Lowpass Filtering 503 8.4.3 Nonlinear Filtering 505

8.5 Key Points 514 Exercises 521

Problems 521 Programming Exercises 527

Supplementary Exercises 529 Supplementary Problems 529 Supplementary Programming Exercises 530

References 531 Further Reading 532

9. Image Restoration and Reconstruction 535 9.1 Introduction and Overview 535

9.1.1 System Model 535 9.2 Noise Models 537

9.2.1 Noise Histograms 537 9.2.2 Periodic Noise 542 9.2.3 Estimation of Noise 543

9.3 Noise Removal Using Spatial Filters 545 9.3.1 Order Filters 548 9.3.2 Mean Filters 553 9.3.3 Adaptive Filters 558

9.4 Degradation Function 569 9.4.1 Spatial Domain: Point Spread Function 569 9.4.2 Frequency Domain: Modulation/Optical

Transfer Function 573 9.4.3 Estimation of the Degradation Function 576

Page 7: DIGITAL IMAGE PROCESSING AND ANALYSIS...Preface xv Acknowledgments xix Author xxi. Section I Introduction to Digital Image Processing and Analysis. 1. Digital Image Processing and

X Contents

9.5 Frequency Domain Filters 577 9.5.1 Inverse Filter 578 9.5.2 Wiener Filter 582 9.5.3 Constrained Least Squares Filter 583 9.5.4 Geometrie Mean Filters 586 9.5.5 Adaptive Filtering 587 9.5.6 Bandpass, Bandreject, and Notch Filters 588 9.5.7 Practical Considerations 591

9.6 Geometrie Transforms 594 9.6.1 Spatial Transforms 595 9.6.2 Gray-Level Interpolation 597 9.6.3 Geometric Restoration Procedure 599 9.6.4 Geometric Restoration with CVIPtools 601

9.7 Image Reconstruction 603 9.7.1 Reconstruction Using Backprojections 604 9.7.2 Radon Transform 608 9.7.3 Fourier-Slice Theorem and Direct Fourier Reconstruction 610

9.8 Key Points 611 Exercises 624

Problems 624 Programming Exercises 629

Supplementary Exercises 631 Supplementary Problems 631 Supplementary Programming Exercises 633

References 633 Further Reading 635

10. Image Compression 637 10.1 Introduction and Overview 637

10.1.1 Compression System Model 641 10.2 Lossless Compression Methods 645

10.2.1 Huff man Coding 649 10.2.2 Run-Length Coding 651 10.2.3 Lempel-Ziv-Welch Coding 655 10.2.4 Arithmetic Coding 656

10.3 Lossy Compression Methods 657 10.3.1 Gray-Level Run-Length Coding 659 10.3.2 Block Truncation Coding 660 10.3.3 Vector Quantization 666 10.3.4 Differential Predictive Coding 670 10.3.5 Model-Based and Fractal Compression 678 10.3.6 Transform Coding 681 10.3.7 Hybrid and Wavelet Methods 688

10.4 Key Points 696 Exercises 702

Problems 702 Programming Exercises 707

Page 8: DIGITAL IMAGE PROCESSING AND ANALYSIS...Preface xv Acknowledgments xix Author xxi. Section I Introduction to Digital Image Processing and Analysis. 1. Digital Image Processing and

Contents xi

Supplementary Exercises 708 Supplementary Problems 708 Supplementary Programming Exercises 709

References 710 Further Reading 711

Section IV Programming and Application Development with CVIPtools

11. CVIPlab 715 11.1 Introduction to CVIPlab 715 11.2 Toolkits, Toolboxes, and Application Libraries 721 11.3 Compiling and Linking CVIPlab 722

11.3.1 How to Build the CVIPlab Project with Microsoft's Visual C++® 2008 722

11.3.2 Mechanics of Adding a Function with Microsoft's Visual C++® 2008 724

11.3.3 Using CVIPlab in the Programming Exercises with Microsoft's Visual C++® 2008 728

11.3.4 Using Microsoft's Visual C++® 2010 731 11.4 Image Data and File Structures 734 11.5 CVIP Projects 739

11.5.1 Digital Image Analysis and Computer Vision Projects 739 11.5.2 Digital Image Processing and Human Vision Projects 741

12. Application Development 743 12.1 Introduction and Overview 743 12.2 CVIP Algorithm Test and Analysis Tool 744

12.2.1 Overview and Capabilities 744 12.2.2 How to Use CVIP-ATAT 744

12.2.2.1 Running CVIP-ATAT 744 12.2.2.2 Creating a New Project 744 12.2.2.3 Inserting Images 745 12.2.2.4 Inputting an Algorithm 747 12.2.2.5 Performing an Algorithm Test Run 751 12.2.2.6 Comparing Images 751

12.2.3 Application Development Example with Fundus Images 754 12.2.3.1 Introduction and Overview 754 12.2.3.2 New Algorithm 755 12.2.3.3 Conclusion 760

12.3 CVIP Feature Extraction and Pattern Classification Tool 761 12.3.1 Overview and Capabilities 761 12.3.2 How to Use CVIP-FEPC 761

12.3.2.1 Running CVIP-FEPC 761 12.3.2.2 Creating a New Project 761 12.3.2.3 Entering Classes in CVIP-FEPC 763 12.3.2.4 Adding Images and Associated Classes 763

Page 9: DIGITAL IMAGE PROCESSING AND ANALYSIS...Preface xv Acknowledgments xix Author xxi. Section I Introduction to Digital Image Processing and Analysis. 1. Digital Image Processing and

xii Contents

12.3.2.5 Applying Feature Extraction and Pattern Classification.... 764 12.3.2.6 Running the Test 766 12.3.2.7 Result File 766

12.3.3 Application Development Example with Veterinary Thermographic Images 770 12.3.3.1 Introduction and Overview 770 12.3.3.2 Experiments 770 12.3.3.3 Results 775 12.3.3.4 Conclusion 775

12.4 Skin Lesion Classification Using Relative Color Features 775 12.4.1 Introduction and Project Overview 775 12.4.2 Materials and Methods 776

12.4.2.1 Image Database 776 12.4.2.2 Creation of Relative Color Images 776 12.4.2.3 Segmentation and Morphological Filtering 777 12.4.2.4 Feature Extraction 777 12.4.2.5 Lesion and Object Feature Spaces 779 12.4.2.6 Establishing Statistical Models 779

12.4.3 Experiments and Data Analysis 780 12.4.3.1 Lesion Feature Space 781 12.4.3.2 Object Feature Space 783

12.4.4 Conclusions 785 12.5 Automatic Segmentation of Blood Vessels in Retinal Images 786

12.5.1 Introduction and Overview 786 12.5.2 Materials and Methods 787 12.5.3 Results 792 12.5.4 Postprocessing with Hough Transform and Edge Linking 794 12.5.5 Conclusion 794

12.6 Classification of Land Types from Satellite Images Using Quadratic Discriminant Analysis and Multilayer Perceptrons 795 12.6.1 Introduction and Overview 795

12.6.2 Data Reduction and Feature Extraction 797 12.6.3 Object Classification 799 12.6.4 Results 800 12.6.5 Conclusion 801 12.6.6 Acknowledgments 803

12.7 Watershed-Based Approach to Skin Lesion Border Segmentation 803 12.7.1 Introduction 803 12.7.2 Materials and Methods 803 12.7.3 Experiments, Results, and Conclusions 809

12.8 Faint Line Defect Detection in Microdisplay (CCD) Elements 811 12.8.1 Introduction and Project Overview 811 12.8.2 Design Methodology 811 12.8.3 Line Detection Algorithm 812

12.8.3.1 Preprocessing 812 12.8.3.2 Edge Detection 814 12.8.3.3 Analysis of the Hough Space 816

12.8.4 Results and Discussion 819 12.8.5 Summary and Conclusion 820

Page 10: DIGITAL IMAGE PROCESSING AND ANALYSIS...Preface xv Acknowledgments xix Author xxi. Section I Introduction to Digital Image Processing and Analysis. 1. Digital Image Processing and

Contents xiii

12.9 Melanoma and Seborrheic Keratosis Differentiation Using Texture Features 820 12.9.1 Introduction and Overview 820 12.9.2 Materials and Methods 821 12.9.3 Texture Analysis Experiments 823 12.9.4 Results and Discussion 830 12.9.5 Conclusion 830 12.9.6 Acknowledgments 831

12.10 Compression of Color Skin Tumor Images with Vector Quantization 831 12.10.1 Introduction and Project Overview 831 12.10.2 Materials and Methods 832

12.10.2.1 Compression Schemes 832 12.10.2.2 Subjective Evaluation of the Images 833

12.10.3 Compression Schemes 834 12.10.3.1 Preprocessing and Transforms 834 12.10.3.2 Vector Quantization 836 12.10.3.3 Postprocessing 840

12.10.4 Results and Analysis 841 12.10.4.1 Results and Analyses for the Schemes with

Compression Ratio 4:1 841 12.10.4.2 Results and Analyses for the Schemes with

Compression Ratio 8:1 842 12.10.4.3 Results and Analyses for the Schemes with

Compression Ratio 14:1 843 12.10.4.4 Results and Analyses for the Schemes with

Compression Ratio 20:1 845 12.10.4.5 Comprehensive Analysis of the Four

Compression Ratios 847 12.10.5 Conclusions and Future Work 849 12.10.6 Acknowledgments 851

References 852

13. CVIPtools C® Function Libraries 855 13.1 Introduction and Overview 855 13.2 Arithmetic and Logic Library: ArithLogic.lib 855

Arithlogic Library Function Prototypes 855 13.3 Band Image Library: Band.lib 856 13.4 Color Image Library: Color.lib 856

Color Library Function Prototypes 857 13.5 Compression Library: Compression.lib 857

Compression Library Function Prototypes 858 13.6 Conversion Library: Conversion.lib 861

Conversion Library Function Prototypes 861 13.7 Display Library: Display.lib 863 13.8 Feature Extraction Library: Feature.lib 864

Feature Library Function Prototypes 864 13.9 Geometry Library: Geometry.lib 867

Geometry Library Function Prototypes 867

Page 11: DIGITAL IMAGE PROCESSING AND ANALYSIS...Preface xv Acknowledgments xix Author xxi. Section I Introduction to Digital Image Processing and Analysis. 1. Digital Image Processing and

xiv Contents

13.10 Histogram Library: Histogram.lib 870 Histogram Library Function Prototypes 870

13.11 Image Library: Image.lib 871 13.12 Data Mapping Library: Mapping.lib 872 13.13 Morphological Library: Morphological.lib 873

Morphological Library Function Prototypes 873 13.14 Noise Library: Noise.lib 875

Noise Library Function Prototypes 875 13.15 Segmentation Library: Segmentation.lib 876

Segmentation Library Function Prototypes 876 13.16 Spatial Filter Library: SpatialFilter.lib 878

Spatial Filter Library Function Prototypes 878 13.17 Transform Library: Transform.lib 884

Transform Library Function Prototypes 884 13.18 Transform Filter Library: TransformFilter.lib 885

Transform Filter Library Function Prototypes 885

Section V Appendices Appendix A: CVIPtools CD 891

Appendix B: Installing and Updating CVIPtools 893

Appendix C: CVIPtools Software Organization 895

Appendix D: CVIPtools С® Functions 897 D.l Toolkit Libraries 897 D.2 Toolbox Libraries 902

Appendix E: Common Object Module (COM) Functions: cviptools.dll 911

Appendix F: CVIP Resources 923

Index 927

: