Photo by Black ice from Pexels

Let’s try to use again the image processing techniques that we have discussed in a more practical and innovative way. This time, we will use image processing to read Sudoku from an image and enter the output into a Sudoku solver algorithm. To do this, it will require us to do three main tasks:

1. Image Processing

2. Digit Recognition

3. Solving the Sudoku.

Image Processing

Let’s start with a simple photo of a Sudoku illustrated in Figure 1. The first step is to detect and extract the digits. We do this by the usual image binarization and using connected components (i.e…

Photo by Kadri Vosumae from Pexels

Now that we are done tackling different image processing techniques, it’s time for us to put them to more practical use. In this post, we will apply the image processing methods we have discussed to prepare our input images and train a classifier model using the leaves dataset.


The data set that we will use composed of 27 photos of different leaves in grayscale format. These leaves can be classified into five, which are labeled from A to E.

Photo by cottonbro from Pexels

In part 4 of this series, we have discussed two objection detection methods: Blob detection and Connected components. These methods detect all the objects in our image based on the evident highlighted blobs or pixels after some initial preprocessing methods like image binarization. In this part, We will discuss another object detection method, which is Template Matching.

Template Matching

This method uses a reference image known as template and slides it across the entire source image one pixel at a time to determine the most similar objects. It will produce another image or matrix where pixel values correspond to how similar our…

Photo by cottonbro from Pexels

In photography and film, a photo or video can be shot at different angles. It could be high, low, straight or over the shoulder, or bird’s eye view, depending on what the person wants to achieve. Because of this, we might encounter scenarios when we need to transform these images into a particular form as part of image correction, enhancement, or other data preprocessing tasks. So in this post, we will discuss how we can manipulate an image using homography.

Homography Matrix

Homography is the mapping between two planar projections of an image. Homography on a 2D Euclidean space is represented by…

Photo by Markus Spiske from Pexels

In the previous post, We discussed how to segment objects in our image using thresholding, Otsu’s method, and color segmentation. These segmentation techniques highly rely on the threshold values we set or are automatically set in Otsu’s method. However, there may be times when we need to segment the image using colors that are not that obvious (e.g., skin color), or we simply cannot get the right threshold and color channels or spaces to use.

This part of the series will discuss other segmentation methods: Chromaticity Segmentation and Image Differencing.

Chromaticity Segmentation

This segmentation utilized the RG Chromaticity space, a color representation…

Photo by Rodion Kutsaiev from Pexels

In the previous post, we have discussed how we can detect all objects in an image. However, it is not always the case that we would like to extract all the objects in an image. Sometimes, we only want to get particular objects of interest. For the first part of this post, we will discuss three methods: Thresholding, Otsu’s Method, and Color Segmentation.


This method is a trial-and-error method to find the adequate threshold value to segment an image from the whole photo. …

Photo by Francis Seura from Pexels

In the previous posts, we focused on enhancing and cleaning our images, like removing some noise and other objects or artifacts in preparation for the next image processing tasks. Now in this post, let’s try to do the more exciting stuff starting with object detection and labeling. We are going to use two main methods: Blob detection and Connected components.

For this post, let’s try to segment and count the number of candies we see in the image below.

Photo by Rathaphon Nanthapreecha from Pexels

Ever wonder how your favorite photo editing tool or native photo manipulation in your smartphones do simple effects such as blurring, sharpening, embossing, and outlining? We will have an idea of how they do in this part, but more importantly, we will discuss the methods we can use to detect and clean our objects of interest from an image. Specifically, we will go through Spatial Filters and Morphological Operations.

Spatial Filters

Spatial filtering is the process of assigning the value of a pixel based on its neighbors. The filters or masks, which are also known as kernels, used in the process are…

Photo by lalesh aldarwish from Pexels

There are times when we don’t always get that Insta-worthy pictures that we like due to external and natural factors such as bad lighting. Sometimes, we can manually manipulate the source of the lighting, change angles, or tweak some settings in our camera to get the desired shot. However, that’s not always the case. There might also be instances when we have to work with photographs captured by old cameras and can’t help having these noises that degrade the quality of our image.

For this post, we will discuss how we can enhance these images by manipulating the pixel values…

Photo by timJ on Unsplash

Image Processing includes methods used to transform and enhance images depending on the context to be solved. It is part of a much broader field, Computer Vision, which deals with processing and analyzing input image and video data to mimic the human visual system. We can use image processing to manipulate a single image for a specific use or as part of data preprocessing methods in preparation for machine learning (ML) model training.

This series of image processing posts will show the cool stuff we can do with our images. For the vloggers and avid socmed users out there, you…


Computer Forensic Noob | Aspiring Data Scientist |

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store