The OpenCV Python library allows you to manipulate and prepare images of multiple formats including .jpg, .png, .tiff, and more. This makes OpenCV a very powerful library for preprocessing images using Python. This activity will introduce you to a few basic functions of the OpenCV library and provide you with some experience using the OpenCV library.
Understand the fundamentals of the OpenCV library.
Explain how to separate colored images into color planes using OpenCV.
Use the OpenCV library to separate a colored image into its three color planes.
Understand the concept of color systems (a further understanding will be provided in the final activity of this module).
Access and ability to use Google Colab
Writing utensils (pencil, pen, etc.)
Printed copy of the OpenCV Worksheet
Python Library - A Python library is a collection of pre-written Python functions meant for use towards specific applications. In the case of the OpenCV library, the pre-written functions allow programmers to alter images through the use of multiple different techniques. One of the main benefits of using Python libraries is that they help to greatly simplify the complexity of code, whilst still allowing for the same result in the output of the code.
Image Manipulation - Image manipulation generally refers to altering the appearance of an image. Image manipulation can include adding, removing, or altering elements of images to achieve a desired effect or outcome. Some examples of image manipulation are filtering an image, scaling an image to be larger or smaller, and cropping an image.
Color System(s) - A color system is considered the way that a set of colors are created, understood, and stored. Most color systems are organized based on a set of primary colors, with the most common being red, green, and blue. The RGB color system and BGR color systems are examples of this. The main difference between the RGB and BGR color systems is how they are combined. In the RGB color system, the colors are combined in the order of red, green, and then blue. In the BGR color system, the colors are combined in the order of blue, green, and then red.
Python, amongst similar programming languages such as MATLAB, is a commonly used image processing language aside from the well-known image editing software (Photoshop). So far in this module we have discussed the necessity of image preprocessing and performed a few image manipulations for preprocessing. The Python library that was used in manipulating the image in the previous unit was the OpenCV library, short for the Open Source Computer Vision library. The OpenCV library is one of the many libraries that can be used in nearly all image processing applications.
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 OpenCV Activity - Exploration Guide and the corresponding OpenCV Image Manipulation - Colab Notebook.
Work through the OpenCV - Knowledge Assessment, you will need the OpenCV Image Manipulation - Colab Notebook for a few portions of this worksheet.
If you would like to learn more about using the OpenCV Python library to perform image manipulations, there are quite a few resources available on the web. We highly suggest running through the OpenCV tutorials available on the official OpenCV website (OpenCV Tutorials).
Geeks for Geeks OpenCV Tutorials - This is a link to a stockpile of image and video processing tutorials for OpenCV in Python. It includes tutorials for installing or importing the library, as well.
IBM Developer Image Processing - This is a link to an article which details the needs for image processing from the perspective of program developers.
Image Processing OpenCV Tutorials - This is a link to the Image Processing page of the OpenCV tutorials, which further explains quite a few image processing concepts and walks you through performing various processing functions.