Image preprocessing entails performing one or more manipulations on an image to prepare the image to be processed. Manipulations on an image can include, but are not limited to, image resizing, image ‘cleaning,’ and image padding. This activity provides an overview of the various techniques used in preprocessing an image, along with a detailed explanation on the necessity of image preprocessing for image processing applications.
Understand and explain why image preprocessing is important to this application.
Understand the common techniques which are utilized for image preprocessing.
Understand and explain how to resize an image.
Understand and explain how to ‘blur’ and dilate an image.
Understand and explain how to pad an image.
Access to a computer and large screen (if you want to share with others)
A Google account to access Google Colab
A pen or pencil
Image Preprocessing - Preprocessing is generally considered to be the preparation of image data via image transformations. These techniques are applied to image datasets in order to ensure analysis on image data is being done on a consistent and adequate set of images for specific applications.
Image Transformation - Image transformations are performed on images in a dataset to normalize values among pixels and other image attributes.
Normalization - Normalization of image data, like with other data analysis methods, scales a set of data into a certain, reasonable range of values for the chosen application. There are multiple types of normalization, many of which are used in various machine learning models.
Image Attributes - An attribute is a source of information that can be used to identify an image. An example of an image attribute is pixel intensity frequency, which can provide an understanding of the variety of color values throughout an image.
This image preprocessing module and following modules rely heavily on your knowledge and ability to manipulate images to prepare them to be input into image processing algorithms. In this activity, you will learn about basic image manipulation techniques, plus how and why these techniques are used for image preprocessing. This activity covers the fundamentals of image resizing, image padding, and image redefining. However, there are many more preprocessing techniques that can be used to prepare images for processing.
Image resizing, also known as image scaling and resampling, is the process of changing an image's dimension by upscaling or downscaling the original image. Resizing uses interpolation techniques to remove or add pixels depending on the type of resizing that is being applied. Different types of interpolation can be used when performing a resize on an image, with the most common type being linear interpolation.
Padding is the addition of pixels around the edges of the images. These pixels can have values of 0 or mimic the values of nearby pixels. This process makes it so that when data is lost during various image preprocessing actions, important data is less likely to be lost.
Redefining an image can be interpreted as quite a few things, though in this context we will consider it as redefining the quality of an image. Redefining image quality consists of either blurring or sharpening an image. In its simplest form, blurring an image entails combining the values of multiple pixels into one pixel, causing the image to be more of an average of all its pixels. Sharpening an image works in a similar but opposite way. Both blurring and sharpening will be discussed in further detail in a future activity.
Ensure that the Image Processing Image Dataset folder (from Module 1 Introduction) is uploaded to your Google Drive as detailed in the Google Colab Interaction Guide.
Read and work through the Image Preprocessing Activity - Exploration Guide and the corresponding Image Preprocessing Activity - Colab Notebook.
Work through the Image Preprocessing Knowledge Assessment, you will need the Google Colab notebook.
There are more image preprocessing techniques than those discussed above, and each have their own advantages. Some of the other most common techniques are listed below; if you would like to learn more about these techniques, we have useful resources provided below each one.
Grayscaling: Python | Grayscaling of Images using OpenCV - GeeksforGeeks
Noise reduction: Python | Denoising of colored images using opencv - GeeksforGeeks
Normalization: Normalize an Image in OpenCV Python - GeeksforGeeks
Binarization: Image Thresholding
Contrast enhancement: Image Enhancement Techniques using OpenCV - Python - GeeksforGeeks
General image preprocessing: The Complete Guide to Image Preprocessing Techniques in Python | by Maahi Patel | Medium