Practical OpenCV
About the Author ...............................................................................................................xiii About the Technical Reviewer ............................................................................................ xv Acknowledgments ............................................................................................................ xvii ■■Part 1: Getting Comfortable .......................................................................... 1 ■■Chapter 1: Introduction to Computer Vision and OpenCV ..................................................3 Why Was This Book Written? .........................................................................................................3 OpenCV ..........................................................................................................................................4 History of OpenCV ..................................................................................................................................................4 Built-in Modules ....................................................................................................................................................4 Summary .......................................................................................................................................5 ■■Chapter 2: Setting up OpenCV on Your Computer ..............................................................7 Operating Systems ........................................................................................................................7 Ubuntu ...................................................................................................................................................................7 Windows ..............................................................................................................................................................12 Mac OSX ..............................................................................................................................................................12 Summary .....................................................................................................................................12 ■■Chapter 3: CV Bling—OpenCV Inbuilt Demos ..................................................................13 Camshift ......................................................................................................................................13 Stereo Matching ..........................................................................................................................16 Homography Estimation in Video ................................................................................................16 Circle and Line Detection ............................................................................................................18 Image Segmentation ...................................................................................................................19 Bounding Box and Circle .............................................................................................................21 Image Inpainting .........................................................................................................................21 Summary .....................................................................................................................................22 ■■Chapter 4: Basic Operations on Images and GUI Windows ..............................................23 Displaying Images from Disk in a Window ..................................................................................23 The cv::Mat Structure ..................................................................................................................24 Creating a cv::Mat ...............................................................................................................................................25 Accessing elements of a cv::Mat ......................................................................................................................... 25 Expressions with cv::Mat ..................................................................................................................................... 25 Converting Between Color-spaces ..............................................................................................26 GUI Track-Bars and Callback Functions ......................................................................................27 Callback Functions .............................................................................................................................................27 ROIs: Cropping a Rectangular Portion out of an Image ...............................................................30 Region of Interest in an Image ............................................................................................................................ 30 Accessing Individual Pixels of an Image .....................................................................................33 Exercise ...............................................................................................................................................................33 Videos ..........................................................................................................................................34 Displaying the Feed from Your Webcam or USB Camera/File .............................................................................. 34 Writing Videos to Disk ..........................................................................................................................................36 Summary .....................................................................................................................................37 ■■ Part 2: Advanced Computer Vision Problems and Coding Them in OpenCV ......................................................................................... 39 ■■Chapter 5: Image Filtering ...............................................................................................41 Image Filters ...............................................................................................................................41 Blurring Images ...................................................................................................................................................45 Resizing Images—Up and Down ......................................................................................................................... 48 Eroding and Dilating Images ................................................................................................................................ 49 Detecting Edges and Corners Efficiently in Images ............................................................................................. 51 Edges ...................................................................................................................................................................51 Canny Edges ........................................................................................................................................................56 Corners ................................................................................................................................................................57 Object Detector App ....................................................................................................................60 Morphological Opening and Closing of Images to Remove Noise ...............................................63 Summary .....................................................................................................................................65 ■■Chapter 6: Shapes in Images ...........................................................................................67 Contours ......................................................................................................................................67 Point Polygon Test ...............................................................................................................................................70 Hough Transform .........................................................................................................................74 Detecting Lines with Hough Transform ................................................................................................................ 74 Detecting Circles with Hough Transform ............................................................................................................. 77 Generalized Hough Transform .....................................................................................................80 RANdom Sample Consensus (RANSAC) .......................................................................................80 Bounding Boxes and Circles ........................................................................................................91 Convex Hulls ................................................................................................................................92 Summary .....................................................................................................................................93 ■■Chapter 7: Image Segmentation and Histograms ............................................................95 Image Segmentation ...................................................................................................................95 Simple Segmentation by Thresholding ................................................................................................................ 96 Floodfill ..............................................................................................................................................................100 Watershed Segmentation .................................................................................................................................. 103 GrabCut Segmentation ......................................................................................................................................110 Histograms ................................................................................................................................111 Equalizing Histograms .......................................................................................................................................111 Histogram Backprojections ............................................................................................................................... 113 Meanshift and Camshift ....................................................................................................................................116 Summary ...................................................................................................................................117 ■■Chapter 8: B asic Machine Learning and Object D etection Based on Keypoints ............119 Keypoints and Keypoint Descriptors: Introduction and Terminology .........................................119 General Terms ....................................................................................................................................................120 How Does the Keypoint-Based Method Work? .................................................................................................. 120 SIFT Keypoints and Descriptors ................................................................................................121 Keypoint Detection and Orientation Estimation ................................................................................................. 121 SIFT Keypoint Descriptors ................................................................................................................................. 125 Matching SIFT Descriptors ................................................................................................................................ 125 SURF Keypoints and Descriptors ...............................................................................................131 SURF Keypoint Detection ...................................................................................................................................131 SURF Descriptor ................................................................................................................................................134 ORB (Oriented FAST and Rotated BRIEF) ...................................................................................136 Oriented FAST Keypoints ...................................................................................................................................137 BRIEF Descriptors ..............................................................................................................................................137 Basic Machine Learning ............................................................................................................140 SVMs ..................................................................................................................................................................141 Object Categorization ................................................................................................................142 Strategy .............................................................................................................................................................142 Organization ......................................................................................................................................................143 Summary ...................................................................................................................................153 ■■ Chapter 9: Affine and Perspective Transformations and Their Applications to Image Panoramas .....................................................................................................155 Affine Transforms ......................................................................................................................155 Applying Affine Transforms ................................................................................................................................ 156 Estimating Affine Transforms ............................................................................................................................. 158 Perspective Transforms .............................................................................................................161 Panoramas ................................................................................................................................166 Summary ...................................................................................................................................172 ■■Chapter 10: 3D Geometry and Stereo Vision .................................................................173 Single Camera Calibration .........................................................................................................173 OpenCV Implementation of Single Camera Calibration ...................................................................................... 176 Stereo Vision .............................................................................................................................179 Triangulation ......................................................................................................................................................179 Calibration .........................................................................................................................................................180 Rectification and Disparity by Matching ............................................................................................................ 186 Summary ...................................................................................................................................200 ■■ Chapter 11: Embedded Computer Vision: Running OpenCV Programs on the Raspberry Pi ................................................................................................................. 201 Raspberry Pi ..............................................................................................................................202 Setting Up Your New Raspberry Pi ............................................................................................202 Installing Raspbian on the Pi ............................................................................................................................. 203 Initial Settings ....................................................................................................................................................204 Installing OpenCV ...............................................................................................................................................205 Camera board ............................................................................................................................206 Camera Board vs. USB Camera ......................................................................................................................... 207 Frame-Rate Comparisons .................................................................................................................................. 214 Usage Examples ........................................................................................................................215 Color-based Object Detector .............................................................................................................................. 216 ORB Keypoint-based Object Detector ................................................................................................................ 217 Summary ...................................................................................................................................218 Index .................................................................................................................................219
剩余228页未读,继续阅读
- 粉丝: 139
- 资源: 333
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
评论2