Photo by Faris Mohammed on Unsplash | The staircases go downward or upward?

An introduction to image dithering that turns fewer colors into more.

Dithering is a means to randomize the quantization error and is widely used in digital audio, video, and grayscale or colored images. For example, the human ear is sensitive to the audio with cyclical error, and we usually introduce “dithering” to convert error to random noise that ears are hard to notice. This article focuses on the application in image processing and shows you how image dithering deceives your visual system.

+ Dithering in the image domain

In image processing, there comes a problem when you render an image on display with a smaller color depth (also called color resolution). …


Image by HBY coding academic | I'll be trying to reveal the secrets of Otsu thresholding in a mathematical way.

Simple yet effective method – Otsu thresholding (envisioned in 1979) makes the conversion from grayscale to a binary image. It is based on the observation of the grayscale histogram and used only the zeroth- and first-order cumulative moment.

Even though this approach was proposed for over 40 years, it is still powerful to cover several practical applications. Interestingly, Otsu thresholding is everywhere, for example, widely used in those image binarization functions in Python or Matlab. In the article, I try to use easy-to-understand mathematical-supported examples to show you why Otsu thresholding makes sense.

+ How Otsu thresholding does?

Given an 8-bit grayscale image I, and…


Do you remember things that happened in your childhood? As for me, when I am looking at some old photos I have taken, all things come into my brain. Maybe, mysterious powers that can rise the deeply buried memory are hidden in “old photos”. This article provides a step-by-step tutorial to show you how to adopt image blending to create an old photo effect.

0. Relationship between “Sepia” and old photos

How special is in one old photo? “Sepia” — is the first adjective that springs to my mind. Most of the old pictures I have seen are toned with sepia. At this point, I think you…


There may contain some imperfections in images under some circumstances, for example, the fingerprint is scanned and then distorted by noises, the image is not intact for not being preserved well. Morphological processing is the way to remove/reduce these imperfections, and it not only can be applied to binary images but also greyscale images. In this article, we only introduce the processing of binary images. There are two sample images with imperfections shown below.

Fingerprint with some noises


In image processing and analysis, we sometimes need a method to separate two related data, for example, background and foreground, land and river. In this article, I’ll introduce a data-driven way that can adaptively find the optimal threshold to distinguish two-class data — Otsu thresholding. This method can be applied in image segmentation and image binarization, and the latter is the main topic in this article.

+ Short introduction

Otsu’s method is an adaptive thresholding way for binarization in image processing. It can find the optimal threshold value of the input image by going through all possible threshold values (from 0 to 255).

+ More details


Canny Edge Detection

+Short introduction

Canny edge detection is the edge detection technique in image processing. It is notable that with the non-maximal suppression and double threshold, this method performs well in both noise processing and edge positioning.

+More details

Canny algorithm can be divided into the steps below (from step 0 to step 5). There are resultant images in each step.

0. Select an input image

Input image

1. Convert the input image to grayscale image.

As for the RGB image, it needs to be converted to grayscale image first. There are two common conversion formulas, and we prefer to use the second one. It is found that human are sensitive to different colors, where green (resp., blue)…

HBY coding academic

Image Processing/Game Designing/Informative and Interesting

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