practical python and opencv_Practical Python and OpenCV(Adrian Rosebrock)

Practical Python and

OpenCV: An Introductory,

Example Driven Guide to

Image Processing and

Computer Vision

CONT ENT S

1 introduction 1

2 python and required packages 5

2.1 NumPy and SciPy . . . . . . . . . . . . . . . . 6

2.1.1 Windows . . . . . . . . . . . . . . . . . 6

2.1.2 OSX . . . . . . . . . . . . . . . . . . . 7

2.1.3 Linux . . . . . . . . . . . . . . . . . . . 7

2.2 Matplotlib . . . . . . . . . . . . . . . . . . . . 7

2.2.1 All Platforms . . . . . . . . . . . . . . 8

2.3 OpenCV . . . . . . . . . . . . . . . . . . . . . . 8

2.3.1 Windows and Linux . . . . . . . . . . 9

2.3.2 OSX . . . . . . . . . . . . . . . . . . . 9

2.4 Mahotas . . . . . . . . . . . . . . . . . . . . . . 9

2.4.1 All Platforms . . . . . . . . . . . . . . 10

2.5 Skip the Installation . . . . . . . . . . . . . . . 10

3 loading, displaying, and saving 11

4 image basics 15

4.1 So, what’s a pixel? . . . . . . . . . . . . . . . 15

4.2 Overview of the Coordinate System . . . . . 18

4.3 Accessing and Manipulating Pixels . . . . . . 18

5 drawing 27

5.1 Lines and Rectangles . . . . . . . . . . . . . . 27

5.2 Circles . . . . . . . . . . . . . . . . . . . . . . 32

6 image processing 37

6.1 Image Transformations . . . . . . . . . . . . . 37

6.1.1 Translation . . . . . . . . . . . . . . . . 38

6.1.2 Rotation . . . . . . . . . . . . . . . . . 43

6.1.3 Resizing . . . . . . . . . . . . . . . . . 48

6.1.4 Flipping . . . . . . . . . . . . . . . . . 54

iii

Contents

6.1.5 Cropping . . . . . . . . . . . . . . . . 57

6.2 Image Arithmetic . . . . . . . . . . . . . . . . 59

6.3 Bitwise Operations . . . . . . . . . . . . . . . 66

6.4 Masking . . . . . . . . . . . . . . . . . . . . . 69

6.5 Splitting and Merging Channels . . . . . . . . 76

6.6 Color Spaces . . . . . . . . . . . . . . . . . . . 80

7 histograms 83

7.1 Using OpenCV to Compute Histograms . . . 84

7.2 Grayscale Histograms . . . . . . . . . . . . . . 85

7.3 Color Histograms . . . . . . . . . . . . . . . . 87

7.4 Histogram Equalization . . . . . . . . . . . . . 93

7.5 Histograms and Masks . . . . . . . . . . . . . 95

8 smoothing and blurring 101

8.1 Averaging . . . . . . . . . . . . . . . . . . . . . 103

8.2 Gaussian . . . . . . . . . . . . . . . . . . . . . 105

8.3 Median . . . . . . . . . . . . . . . . . . . . . . 106

8.4 Bilateral . . . . . . . . . . . . . . . . . . . . . . 109

9 thresholding 112

9.1 Simple Thresholding . . . . . . . . . . . . . . 112

9.2 Adaptive Thresholding . . . . . . . . . . . . . 116

9.3 Otsu and Riddler-Calvard . . . . . . . . . . . 120

10 gradients and edge detection 124

10.1 Laplacian and Sobel . . . . . . . . . . . . . . . 125

10.2 Canny Edge Detector . . . . . . . . . . . . . . 130

11 contours 133

11.1 Counting Coins . . . . . . . . . . . . . . . . . 133

12 where to now? 142

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值