Practical OpenCV
文件大小: 12366k
源码售价: 10 个金币 积分规则     积分充值
资源说明: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
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。