This book starts with basic Image Processing and manipulation problems and demonstrates how to solve them with popular Python libraries and modules. It then concentrates on problems based on Geometric image transformations and problems to be solved with Image hashing.
Next, the book focuses on solving problems based on Sampling, Convolution, Discrete Fourier transform, Frequency domain filtering and image restoration with deconvolution. It also aims at solving Image enhancement problems
using different algorithms such as spatial filters and create a super resolution image using SRGAN.
Finally, it explores popular facial image processing problems and solves them with Machine learning and Deep learning models using popular python ML / DL libraries.
Cover Page
Title Page
Copyright Page
Dedication Page
About the Author
About the Reviewer
Acknowledgements
Preface
Errata
Table of Contents
1. Basic Image and Video Processing
Introduction
Structure
Objectives
Problems
Display RGB image color channels in 3D
Video I/O
Read/write video files with scikit-video
Capture video from camera and extract frames with OpenCV-Python
Implement Instagram-like Gotham filter
The Gotham filter
Interpolation with NumPy interp() function
Explore image manipulations with different python libraries
Plot image montage with scikit-image
Crop/resize images with the SciPy ndimage module
Draw contours with OpenCV-Python
Counting objects in an image
Convert a PNG image with palette to grayscale with PIL
Different ways to convert an RGB image to grayscale
Rotating an image with scipy.ndimage
Image differences with PIL
Converting RGB to HSV and YUV color spaces with scikit-image
Resizing an image with OpenCV-Python
Add a logo to an image with scikit-image
Change brightness/contrast of an image with linear transform and gamma correction with OpenCV-Python
Detecting colors and changing colors of objects with OpenCV-Python
Object removal with seam carving
Creating fake miniature effect
Summary
Questions
Key terms
References
2. More Image Transformation and Manipulation
Introduction
Structure
Objectives
Problems
Applying Euclidean and Affine transformation on an image
Basics of linear geometric transformations in 2D
Rotating an image with scipy.ndimage
Flipping and flopping an image with NumPy
Apply affine transformation with scipy.ndimage
Implement image transformation with warping/inverse warping using scikit-image and scipy.ndimage
Applying translation on an image using scikit-image warp
Implementing the swirl transformation using scikit-image warp
Implementing swirl transform using scipy.ndimage
Implementing elastic deformation
Image projection with homography using scikit-image
Detecting colors and changing colors of objects with OpenCV-Python
Detecting Covid-19 virus objects with colors in the HSV colorspace
Finding duplicate and similar images with hashing
Using Perceptual Hash function (pHash) to find similar images using imagehash
Summary
Questions
Key terms
References
3. Sampling, Convolution, Discrete Fourier, Cosine and Wavelet Transform
Introduction
Structure
Objectives
Problems
Fourier Transform Basics
Sampling to increase/decrease the resolution of an image
Up-sampling an image by using the DFT and a low pass filter (LPF)
Down-sampling with anti-aliasing using the Gaussian filter
Denoising an image with LPF/Notch filter in the Frequency domain
Removing periodic noise with Notch filter
Removing salt and pepper noise using the Gaussian LPF with scipy fftpack
Blurring an image with an LPF in the frequency domain
Different blur kernels and convolution in the frequency domain
Blurring with scipy.ndimage frequency-domain filters
With fourier_gaussian
With fourier_uniform
With fourier_ellipsoid
Gaussian blur LPF with scipy.fftpack
Convolution in the frequency domain with a colored image using fftconvolve from scipy signal
Edge detection with high pass filters (HPF) in the frequency domain
Implementation of homomorphic filters
Summary
Questions
Key terms
References
4. Discrete Cosine/Wavelet Transform and Deconvolution
Introduction
Structure
Objectives
Template matching with phase-correlation in the frequency domain
Image compression with the Discrete Cosine Transform (DCT)
JPEG compression
Image denoising with Discrete Cosine Transform (DCT)
Deconvolution for image deblurring
Blur detection
Non-blind deblurring with SimpleITK deconvolution filters
Non-blind deblurring with scikit-image restoration module functions
Image denoising with wavelets
Wavelet basics
Image denoising using wavelets with pywt
Image denoising with wavelets using scikit-image restoration
Image fusion with wavelets
Fusion algorithm
Secure spread spectrum digital watermarking with the DCT
Summary
Questions
Key terms
References
5. Image Enhancement
Introduction
Structure
Problems
Image Enhancement Filters with PIL for noise removal and smoothing
BLUR filter to remove salt and pepper noise
Gaussian BLUR filter to remove salt and pepper noise
Median filter to remove salt and pepper noise
Max, min, and mode filters to remove outliers from an image
Min filter
Max filter
Mode filter
Progressive application of Gaussian blur, median, mode, and max filters on an image
Unsharp masking to sharpen an image
With the scikit-image filters module
With the PIL ImageFilter module
Laplacian sharpening with SimpleITK
Implementing a unsharp mask with opencv-python
Averaging of images to remove random noise
Image denoising with curvature-driven algorithms
Anisotropic diffusion
Contrast stretching/histogram equalization with opencv-python
Fingerprint cleaning and minutiaes extraction
Fingerprint cleaning with morphological operations
Feature (minutiae) extraction from an enhanced fingerprint
Edge detection with LOG/zero-crossing, canny versus holistically-nested
Computing the image derivatives
With LoG/zero-crossing
Marr-Hildteth (LOG) algorithm
With canny and holistically-nested (deep learning model based)
Canny edge detection
Holistically-nested edge detection
Summary
Questions
Key terms
References
6. More Image Enhancement
Introduction
Structure
Problems
Object detection with Hough transform and colors
Counting circular objects in an image with the circle Hough transform
Detecting lines with progressive probabilistic Hough transform
Detecting objects of arbitrary shapes using the generalized Hough transform
Detecting objects with colors in HSV colorspace
Object saliency map, depth map, and tone map (HDR) with OpenCV-python
Creating object saliency map
Creating depth-map from stereo images
Tone mapping and High Dynamic Range (HDR) imaging
Pyramid blending
Constructing the Gaussian pyramid
Constructing the Laplacian Pyramid
Reconstructing an image only from its Laplacian pyramid
Blending images with pyramids
Image Super Resolution with Deep Learning Model (SRGAN)
Low-light image enhancement using CNNs
Realistic image dehazing using deep neural net
Distributed image processing with Dask
Summary
Questions
Key terms
References
7. Face Image Processing
Introduction
Structure
Objectives
Problems
Face morphing with dlib, scipy.spatial, and opencv-python
Facial landmark detection with deep learning models
Facial landmark detection with Keras
Facial landmark detection with the MTCNN
Implementation of face swapping
Implementation of face parsing
Face recognition with FisherFaces
Face recognition with Local Binary Patterns Histogram (LBPH) with opencv-python
Face detection and recognition with Microsoft Cognitive Vision APIs
This book starts with basic Image Processing and manipulation problems and demonstrates how to solve them with popular Python libraries and modules. It then concentrates on problems based on Geometric image transformations and problems to be solved with Image hashing.
Next, the book focuses on solving problems based on Sampling, Convolution, Discrete Fourier transform, Frequency domain filtering and image restoration with deconvolution. It also aims at solving Image enhancement problems
using different algorithms such as spatial filters and create a super resolution image using SRGAN.
Finally, it explores popular facial image processing problems and solves them with Machine learning and Deep learning models using popular python ML / DL libraries.
Table of contents
Cover Page
Title Page
Copyright Page
Dedication Page
About the Author
About the Reviewer
Acknowledgements
Preface
Errata
Table of Contents
1. Basic Image and Video Processing
Introduction
Structure
Objectives
Problems
Display RGB image color channels in 3D
Video I/O
Read/write video files with scikit-video
Capture video from camera and extract frames with OpenCV-Python
Implement Instagram-like Gotham filter
The Gotham filter
Interpolation with NumPy interp() function
Explore image manipulations with different python libraries
Plot image montage with scikit-image
Crop/resize images with the SciPy ndimage module
Draw contours with OpenCV-Python
Counting objects in an image
Convert a PNG image with palette to grayscale with PIL
Different ways to convert an RGB image to grayscale
Rotating an image with scipy.ndimage
Image differences with PIL
Converting RGB to HSV and YUV color spaces with scikit-image
Resizing an image with OpenCV-Python
Add a logo to an image with scikit-image
Change brightness/contrast of an image with linear transform and gamma correction with OpenCV-Python
Detecting colors and changing colors of objects with OpenCV-Python
Object removal with seam carving
Creating fake miniature effect
Summary
Questions
Key terms
References
2. More Image Transformation and Manipulation
Introduction
Structure
Objectives
Problems
Applying Euclidean and Affine transformation on an image
Basics of linear geometric transformations in 2D
Rotating an image with scipy.ndimage
Flipping and flopping an image with NumPy
Apply affine transformation with scipy.ndimage
Implement image transformation with warping/inverse warping using scikit-image and scipy.ndimage
Applying translation on an image using scikit-image warp
Implementing the swirl transformation using scikit-image warp
Implementing swirl transform using scipy.ndimage
Implementing elastic deformation
Image projection with homography using scikit-image
Detecting colors and changing colors of objects with OpenCV-Python
Detecting Covid-19 virus objects with colors in the HSV colorspace
Finding duplicate and similar images with hashing
Using Perceptual Hash function (pHash) to find similar images using imagehash
Summary
Questions
Key terms
References
3. Sampling, Convolution, Discrete Fourier, Cosine and Wavelet Transform
Introduction
Structure
Objectives
Problems
Fourier Transform Basics
Sampling to increase/decrease the resolution of an image
Up-sampling an image by using the DFT and a low pass filter (LPF)
Down-sampling with anti-aliasing using the Gaussian filter
Denoising an image with LPF/Notch filter in the Frequency domain
Removing periodic noise with Notch filter
Removing salt and pepper noise using the Gaussian LPF with scipy fftpack
Blurring an image with an LPF in the frequency domain
Different blur kernels and convolution in the frequency domain
Blurring with scipy.ndimage frequency-domain filters
With fourier_gaussian
With fourier_uniform
With fourier_ellipsoid
Gaussian blur LPF with scipy.fftpack
Convolution in the frequency domain with a colored image using fftconvolve from scipy signal
Edge detection with high pass filters (HPF) in the frequency domain
Implementation of homomorphic filters
Summary
Questions
Key terms
References
4. Discrete Cosine/Wavelet Transform and Deconvolution
Introduction
Structure
Objectives
Template matching with phase-correlation in the frequency domain
Image compression with the Discrete Cosine Transform (DCT)
JPEG compression
Image denoising with Discrete Cosine Transform (DCT)
Deconvolution for image deblurring
Blur detection
Non-blind deblurring with SimpleITK deconvolution filters
Non-blind deblurring with scikit-image restoration module functions
Image denoising with wavelets
Wavelet basics
Image denoising using wavelets with pywt
Image denoising with wavelets using scikit-image restoration
Image fusion with wavelets
Fusion algorithm
Secure spread spectrum digital watermarking with the DCT
Summary
Questions
Key terms
References
5. Image Enhancement
Introduction
Structure
Problems
Image Enhancement Filters with PIL for noise removal and smoothing
BLUR filter to remove salt and pepper noise
Gaussian BLUR filter to remove salt and pepper noise
Median filter to remove salt and pepper noise
Max, min, and mode filters to remove outliers from an image
Min filter
Max filter
Mode filter
Progressive application of Gaussian blur, median, mode, and max filters on an image
Unsharp masking to sharpen an image
With the scikit-image filters module
With the PIL ImageFilter module
Laplacian sharpening with SimpleITK
Implementing a unsharp mask with opencv-python
Averaging of images to remove random noise
Image denoising with curvature-driven algorithms
Anisotropic diffusion
Contrast stretching/histogram equalization with opencv-python
Fingerprint cleaning and minutiaes extraction
Fingerprint cleaning with morphological operations
Feature (minutiae) extraction from an enhanced fingerprint
Edge detection with LOG/zero-crossing, canny versus holistically-nested
Computing the image derivatives
With LoG/zero-crossing
Marr-Hildteth (LOG) algorithm
With canny and holistically-nested (deep learning model based)
Canny edge detection
Holistically-nested edge detection
Summary
Questions
Key terms
References
6. More Image Enhancement
Introduction
Structure
Problems
Object detection with Hough transform and colors
Counting circular objects in an image with the circle Hough transform
Detecting lines with progressive probabilistic Hough transform
Detecting objects of arbitrary shapes using the generalized Hough transform
Detecting objects with colors in HSV colorspace
Object saliency map, depth map, and tone map (HDR) with OpenCV-python
Creating object saliency map
Creating depth-map from stereo images
Tone mapping and High Dynamic Range (HDR) imaging
Pyramid blending
Constructing the Gaussian pyramid
Constructing the Laplacian Pyramid
Reconstructing an image only from its Laplacian pyramid
Blending images with pyramids
Image Super Resolution with Deep Learning Model (SRGAN)
Low-light image enhancement using CNNs
Realistic image dehazing using deep neural net
Distributed image processing with Dask
Summary
Questions
Key terms
References
7. Face Image Processing
Introduction
Structure
Objectives
Problems
Face morphing with dlib, scipy.spatial, and opencv-python
Facial landmark detection with deep learning models
Facial landmark detection with Keras
Facial landmark detection with the MTCNN
Implementation of face swapping
Implementation of face parsing
Face recognition with FisherFaces
Face recognition with Local Binary Patterns Histogram (LBPH) with opencv-python
Face detection and recognition with Microsoft Cognitive Vision APIs