开启机器视觉之旅:OpenCV基础与实践

5星 · 超过95%的资源 需积分: 10 100 下载量 96 浏览量 更新于2024-07-23 1 收藏 12.95MB PDF 举报
"A Practical Introduction to Computer Vision with OpenCV_2014" 本文档是对计算机视觉领域的一个实用介绍,作者是Kenneth Dawson-Howe,来自爱尔兰都柏林三一学院。书中主要探讨了如何利用OpenCV这个强大的库来处理图像和视频,实现机器对周围环境的理解。 计算机视觉是模拟人类视觉感知的一种技术,通过摄像头和麦克风等设备获取数据,再利用高速计算能力进行有意义的数据处理。随着硬件设备的快速发展,计算机视觉在各个领域中变得越来越普遍,如游戏控制、自动人脸识别、车牌识别、身份验证以及工厂自动化等。 OpenCV(开源计算机视觉库)是一个广泛使用的工具,它提供了丰富的函数和算法,用于图像处理、特征检测、物体识别和运动分析等任务。书中将涵盖基础的图像处理技术,帮助读者理解并解决实际问题。这包括但不限于图像滤波、边缘检测、颜色空间转换、形态学操作等。 例如,图像处理中的边缘检测是计算机视觉中的关键步骤,它能够帮助机器识别出图像中的边界,如Canny边缘检测算法就是一种常用方法。形态学操作,如腐蚀和膨胀,则有助于去除噪声,提取图像中的目标结构。此外,特征匹配和对象识别则涉及到SIFT、SURF等算法,这些技术在现实世界的应用中如人脸识别和目标追踪中非常关键。 OpenCV还支持深度学习框架,使得系统可以学习并理解更复杂的视觉模式。这在自动驾驶、机器人导航和智能监控等领域具有重大意义。书中可能也会涉及一些基本的机器学习概念,如支持向量机(SVM)或神经网络,这些在分类和识别任务中扮演着重要角色。 随着计算机视觉技术的不断进步,我们可以预见到更多创新应用的出现。无论是增强现实、医疗影像分析还是智能家居,计算机视觉都在其中发挥着核心作用。这本书旨在为初学者提供一个理解这一领域的起点,同时也为有经验的开发者提供了实用的参考资料。 "A Practical Introduction to Computer Vision with OpenCV_2014"是一本面向实践的计算机视觉入门指南,涵盖了从基本图像处理到高级视觉任务的关键技术和应用,利用OpenCV这个强大的工具,帮助读者深入理解并开发自己的计算机视觉系统。
2015-06-26 上传
Contents Preface xiii 1 Introduction 1 1.1 A Difficult Problem 1 1.2 The Human Vision System 2 1.3 Practical Applications of Computer Vision 3 1.4 The Future of Computer Vision 5 1.5 Material in This Textbook 6 1.6 Going Further with Computer Vision 7 2 Images 9 2.1 Cameras 9 2.1.1 The Simple Pinhole Camera Model 9 2.2 Images 10 2.2.1 Sampling 11 2.2.2 Quantisation 11 2.3 Colour Images 13 2.3.1 Red–Green–Blue (RGB) Images 14 2.3.2 Cyan–Magenta–Yellow (CMY) Images 17 2.3.3 YUV Images 17 2.3.4 Hue Luminance Saturation (HLS) Images 18 2.3.5 Other Colour Spaces 20 2.3.6 Some Colour Applications 20 2.4 Noise 22 2.4.1 Types of Noise 23 2.4.2 Noise Models 25 2.4.3 Noise Generation 26 2.4.4 Noise Evaluation 26 2.5 Smoothing 27 2.5.1 Image Averaging 27 2.5.2 Local Averaging and Gaussian Smoothing 28 2.5.3 Rotating Mask 30 2.5.4 Median Filter 31 3 Histograms 35 3.1 1D Histograms 35 3.1.1 Histogram Smoothing 36 3.1.2 Colour Histograms 37 3.2 3D Histograms 39 3.3 Histogram/Image Equalisation 40 3.4 Histogram Comparison 41 3.5 Back-projection 43 3.6 k-means Clustering 44 4 Binary Vision 49 4.1 Thresholding 49 4.1.1 Thresholding Problems 50 4.2 Threshold Detection Methods 51 4.2.1 Bimodal Histogram Analysis 52 4.2.2 Optimal Thresholding 52 4.2.3 Otsu Thresholding 54 4.3 Variations on Thresholding 56 4.3.1 Adaptive Thresholding 56 4.3.2 Band Thresholding 57 4.3.3 Semi-thresholding 58 4.3.4 Multispectral Thresholding 58 4.4 Mathematical Morphology 59 4.4.1 Dilation 60 4.4.2 Erosion 62 4.4.3 Opening and Closing 63 4.4.4 Grey-scale and Colour Morphology 65 4.5 Connectivity 66 4.5.1 Connectedness: Paradoxes and Solutions 66 4.5.2 Connected Components Analysis 67 5 Geometric Transformations 71 5.1 Problem Specification and Algorithm 71 5.2 Affine Transformations 73 5.2.1 Known Affine Transformations 74 5.2.2 Unknown Affine Transformations 75 5.3 Perspective Transformations 76 5.4 Specification of More Complex Transformations 78 5.5 Interpolation 78 5.5.1 Nearest Neighbour Interpolation 79 5.5.2 Bilinear Interpolation 79 5.5.3 Bi-Cubic Interpolation 80 5.6 Modelling and Removing Distortion from Cameras 80 5.6.1 Camera Distortions 81 5.6.2 Camera Calibration and Removing Distortion 82 6 Edges 83 6.1 Edge Detection 83 6.1.1 First Derivative Edge Detectors 85 6.1.2 Second Derivative Edge Detectors 92 6.1.3 Multispectral Edge Detection 97 6.1.4 Image Sharpening 98 6.2 Contour Segmentation 99 6.2.1 Basic Representations of Edge Data 99 6.2.2 Border Detection 102 6.2.3 Extracting Line Segment Representations of Edge Contours 105 6.3 Hough Transform 108 6.3.1 Hough for Lines 109 6.3.2 Hough for Circles 111 6.3.3 Generalised Hough 112 7 Features 115 7.1 Moravec Corner Detection 117 7.2 Harris Corner Detection 118 7.3 FAST Corner Detection 121 7.4 SIFT 122 7.4.1 Scale Space Extrema Detection 123 7.4.2 Accurate Keypoint Location 124 7.4.3 Keypoint Orientation Assignment 126 7.4.4 Keypoint Descriptor 127 7.4.5 Matching Keypoints 127 7.4.6 Recognition 127 7.5 Other Detectors 129 7.5.1 Minimum Eigenvalues 130 7.5.2 SURF 130 8 Recognition 131 8.1 Template Matching 131 8.1.1 Applications 131 8.1.2 Template Matching Algorithm 133 8.1.3 Matching Metrics 134 8.1.4 Finding Local Maxima or Minima 135 8.1.5 Control Strategies for Matching 137 8.2 Chamfer Matching 137 8.2.1 Chamfering Algorithm 137 8.2.2 Chamfer Matching Algorithm 139 8.3 Statistical Pattern Recognition 140 8.3.1 Probability Review 142 8.3.2 Sample Features 143 8.3.3 Statistical Pattern Recognition Technique 149 8.4 Cascade of Haar Classifiers 152 8.4.1 Features 154 8.4.2 Training 156 8.4.3 Classifiers 156 8.4.4 Recognition 158 8.5 Other Recognition Techniques 158 8.5.1 Support Vector Machines (SVM) 158 8.5.2 Histogram of Oriented Gradients (HoG) 159 8.6 Performance 160 8.6.1 Image and Video Datasets 160 8.6.2 Ground Truth 161 8.6.3 Metrics for Assessing Classification Performance 162 8.6.4 Improving Computation Time 165 9 Video 167 9.1 Moving Object Detection 167 9.1.1 Object of Interest 168 9.1.2 Common Problems 168 9.1.3 Difference Images 169 9.1.4 Background Models 171 9.1.5 Shadow Detection 179 9.2 Tracking 180 9.2.1 Exhaustive Search 181 9.2.2 Mean Shift 181 9.2.3 Dense Optical Flow 182 9.2.4 Feature Based Optical Flow 185 9.3 Performance 186 9.3.1 Video Datasets (and Formats) 186 9.3.2 Metrics for Assessing Video Tracking Performance 187 10 Vision Problems 189 10.1 Baby Food 189 10.2 Labels on Glue 190 10.3 O-rings 191 10.4 Staying in Lane 192 10.5 Reading Notices 193 10.6 Mailboxes 194 10.7 Abandoned and Removed Object Detection 195 10.8 Surveillance 196 10.9 Traffic Lights 197 10.10 Real Time Face Tracking 198 10.11 Playing Pool 199 10.12 Open Windows 200 10.13 Modelling Doors 201 10.14 Determining the Time from Analogue Clocks 202 10.15 Which Page 203 10.16 Nut/Bolt/Washer Classification 204 10.17 Road Sign Recognition 205 10.18 License Plates 206 10.19 Counting Bicycles 207 10.20 Recognise Paintings 208 References 209 Index 213