Title Page Copyright and Credits Mastering OpenCV 4 with Python About Packt Why subscribe? Packt.com Contributors About the author About the reviewers Packt is searching for authors like you Preface Who this book is for What this book covers To get the most out of this book Download the example code files Download the color images Conventions used Get in touch Reviews Section 1: Introduction to OpenCV 4 and Python Setting Up OpenCV Technical requirements Code testing specifications Hardware specifications Understanding Python Introducing OpenCV Contextualizing the reader A theoretical introduction to the OpenCV library OpenCV modules OpenCV users OpenCV applications Why citing OpenCV in your research work Installing OpenCV, Python, and other packages Installing Python, OpenCV, and other packages globally Installing Python Installing Python on Linux Installing Python on Windows Installing OpenCV Installing OpenCV on Linux Installing OpenCV on Windows Testing the installation Installing Python, OpenCV, and other packages with virtualenv Python IDEs to create virtual environments with virtualenv Anaconda/Miniconda distributions and conda package–and environment-management system  Packages for scientific computing, data science, machine learning, deep learning, and computer vision Jupyter Notebook Trying Jupiter Notebook online  Installing the Jupyter Notebook Installing Jupyter using Anaconda Installing Jupyter with pip The OpenCV and Python project structure Our first Python and OpenCV project Summary Questions Further reading Image Basics in OpenCV Technical requirements A theoretical introduction to image basics Main problems in image processing Image-processing steps Images formulation Concepts of pixels, colors, channels, images, and color spaces File extensions The coordinate system in OpenCV Accessing and manipulating pixels in OpenCV Accessing and manipulating pixels in OpenCV with BGR images Accessing and manipulating pixels in OpenCV with grayscale images BGR order in OpenCV Summary Questions Further reading Handling Files and Images Technical requirements An introduction to handling files and images sys.argv Argparse – command-line option and argument parsing Reading and writing images Reading images in OpenCV Reading and writing images in OpenCV Reading camera frames and video files Reading camera frames Accessing some properties of the capture object Saving camera frames Reading a video file Reading from an IP camera Writing a video file Calculating frames per second Considerations for writing a video file Playing with video capture properties Getting all the properties from the video capture object Using the properties – playing a video backwards Summary Questions Further reading Constructing Basic Shapes in OpenCV Technical requirements A theoretical introduction to drawing in OpenCV Drawing shapes Basic shapes – lines, rectangles, and circles Drawing lines Drawing rectangles Drawing circles Understanding advanced shapes Drawing a clip line Drawing arrows Drawing ellipses Drawing polygons Shift parameter in drawing functions lineType parameter in drawing functions Writing text Drawing text Using all OpenCV text fonts More functions related to text Dynamic drawing with mouse events Drawing dynamic shapes Drawing both text and shapes Event handling with Matplotlib Advanced drawing Summary Questions Further reading Section 2: Image Processing in OpenCV Image Processing Techniques Technical requirements Splitting and merging channels in OpenCV Geometric transformations of images Scaling an image Translating an image Rotating an image Affine transformation of an image Perspective transformation of an image Cropping an image Image filtering Applying arbitrary kernels Smoothing images Averaging filter Gaussian filtering Median filtering Bilateral filtering Sharpening images Common kernels in image processing Creating cartoonized images Arithmetic with images Saturation arithmetic Image addition and subtraction Image blending Bitwise operations Morphological transformations Dilation operation Erosion operation Opening operation Closing operation Morphological gradient operation Top hat operation Black hat operation Structuring element Applying morphological transformations to images Color spaces Showing color spaces Skin segmentation in different color spaces Color maps Color maps in OpenCV Custom color maps Showing the legend for the custom color map Summary Questions Further reading Constructing and Building Histograms Technical requirements A theoretical introduction to histograms Histogram terminology Grayscale histograms Grayscale histograms without a mask Grayscale histograms with a mask Color histograms Custom visualizations of histograms Comparing OpenCV, NumPy, and Matplotlib histograms Histogram equalization Grayscale histogram equalization Color histogram equalization Contrast Limited Adaptive Histogram Equalization  Comparing CLAHE and histogram equalization Histogram comparison Summary Questions Further reading Thresholding Techniques Technical requirements Installing scikit-image Installing SciPy Introducing thresholding techniques Simple thresholding  Thresholding types Simple thresholding applied to a real image Adaptive thresholding Otsu's thresholding algorithm The triangle binarization algorithm Thresholding color images Thresholding algorithms using scikit-image Introducing thresholding with scikit-image Trying out more thresholding techniques with scikit-image Summary Questions Further reading Contour Detection, Filtering, and Drawing Technical requirements An introduction to contours Compressing contours Image moments Some object features based on moments Hu moment invariants Zernike moments More functionality related to contours Filtering contours Recognizing contours Matching contours Summary Questions Further reading Augmented Reality Technical requirements An introduction to augmented reality Markerless-based augmented reality Feature detection Feature matching Feature matching and homography computation to find objects Marker-based augmented reality Creating markers and dictionaries Detecting markers Camera calibration Camera pose estimation Camera pose estimation and basic augmentation Camera pose estimation and more advanced augmentation Snapchat-based augmented reality Snapchat-based augmented reality OpenCV moustache overlay Snapchat-based augmented reality OpenCV glasses overlay QR code detection Summary Questions Further reading Section 3: Machine Learning and Deep Learning in OpenCV Machine Learning with OpenCV Technical requirements An introduction to machine learning Supervised machine learning Unsupervised machine learning Semi-supervised machine learning k-means clustering Understanding k-means clustering Color quantization using k-means clustering k-nearest neighbor Understanding k-nearest neighbors Recognizing handwritten digits using k-nearest neighbor  Support vector machine Understanding SVM Handwritten digit recognition using SVM Summary Questions Further reading Face Detection, Tracking, and Recognition Technical requirements Installing dlib Installing the face_recognition package Installing the cvlib package Face processing introduction Face detection Face detection with OpenCV Face detection with dlib Face detection with face_recognition Face detection with cvlib Detecting facial landmarks Detecting facial landmarks with OpenCV Detecting facial landmarks with dlib Detecting facial landmarks with face_recognition Face tracking Face tracking with the dlib DCF-based tracker Object tracking with the dlib DCF-based tracker Face recognition Face recognition with OpenCV Face recognition with dlib Face recognition with face_recognition Summary Questions Further reading Introduction to Deep Learning Technical requirements Installing TensorFlow Installing Keras Deep learning overview for computer vision tasks Deep learning characteristics Deep learning explosion Deep learning for image classification Deep learning for object detection  Deep learning in OpenCV Understanding cv2.dnn.blobFromImage() Complete examples using the OpenCV DNN face detector OpenCV deep learning classification AlexNet for image classification GoogLeNet for image classification ResNet for image classification SqueezeNet for image classification OpenCV deep learning object detection MobileNet-SSD for object detection YOLO for object detection The TensorFlow library Introduction example to TensorFlow Linear regression in TensorFlow Handwritten digits recognition using TensorFlow The Keras library Linear regression in Keras Handwritten digit recognition in Keras Summary Questions Further reading Section 4: Mobile and Web Computer Vision Mobile and Web Computer Vision with Python and OpenCV Technical requirements Installing the packages Introduction to Python web frameworks Introduction to Flask Web computer vision applications using OpenCV and Flask A minimal example to introduce OpenCV and Flask  Minimal face API using OpenCV Deep learning cat detection API using OpenCV Deep learning API using Keras and Flask Keras applications Deep learning REST API using Keras Applications Deploying a Flask application to the cloud Summary Questions Further reading Assessments Chapter 1 Chapter 2  Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Other Books You May Enjoy Leave a review - let other readers know what you think