Member-only story
A Brief Look into Image Preprocessing for doing AI in Computer Vision
Andi Sama — CIO, Sinergi Wahana Gemilang with Andrew Widjaja and Cahyati S. Sangaji
#SinergiWahanaGemilang #ArtificialIntelligence #ComputerVision #IBMVisualInsights #GoogleAutoML #ImagePreprocessing #PythonImageLibrary #Matplotlib #Keras #OpenCV
Supporting files (Python Notebook file + Images) for this article can be found in github.
When we are building a machine learning (or deep learning) model in computer vision with Python, we often use dataset in the form of images or videos. By doing it by hand without any automated tools such as IBM Visual Insights or Google AutoML for example, most of the time we need to preprocess the data before it can be consumed by our machine learning algorithm.
This article focuses on introducing approaches in doing preprocessing on source image by transforming image to numpy array and vice versa (JPEG, PNG format). It is implemented in Python programming language by using common open source libraries such as Python Image Library (PIL), Matplotlib, Keras and OpenCV.
The following shows the sample of a source image (resides in ‘data/smurf.jpg’) that we use in this article (Avforums, 2017). The source image file is encoded in RGB sequence — Red, Green, Blue. This sequence is important since in OpenCV for example, the encoded sequence is BGR (Blue, Green, Red) instead of RGB.