Reducing the number of colors in an image is also called Color quantization. It’s commonly used for generating GIF images which currently supports only 256 colors. The general idea is, group similar colors in an image into regions, replace them with the color which closely resembles or represents the region. This color is also called […]
Category: Computer Vision
Basics of Image Convolution
Convolution is a process used for applying general-purpose filter effects like blurring, sharpening, embossing, edge detection, and more. To understand convolutions we must first understand what a convolution matrix is, also referred to as kernel. Take for example the blurring filter. In blur filter, we set each pixel to the mean of its neighbouring pixels. […]
Segmenting lines in handwritten documents using A* Path planning algorithm
In this article, I will explain a widely used method for segmenting handwritten documents into individual lines. Below is a sample output from my algorithm. The below flowchart outlines the different steps involved in the segmentation process. The explained method will only work with non-skewed documents. To de-skew the document, you can refer to my […]
Deskewing scanned documents using horizontal projections
An important pre-processing step in any OCR tool or algorithm is to deskew the scanned document first. Take a look at the below sample scanned image, its tilted by a small angle. In this article I will explain a method to deskew these types of documents using their horizontal projections. The final outcome of deskewing […]
Draw bounding box around contours – skimage
The basic idea is to find the Xmin, Xmax, Ymin, Ymax of each identified coordinates of the contour and then create a rectangle using it. Lets understand this with an example: Import the necessary libraries, read the input file, convert it to grayscale and plot it. Now we use the skimage find_contours method to identify […]
Harris Corner Detector implementation in python
The Harris corner detection algorithm also called the Harris & Stephens corner detector is one of the simplest corner detectors available. The idea is to locate interest points where the surrounding neighbourhood shows edges in more than one direction. The basic idea of algorithm is to find the difference in intensity for a displacement of […]
Sobel Feldman operator or Sobel filter
Sobel operator is used in computer vision particularly in edge detection algorithms. The operator uses two 3ร3 kernels which are convolved with the original image to calculate the image derivatives โ one for horizontal changes, and one for vertical. If we define A as the original image, and Gx and Gy are two images which […]
Converting Color Images to Grayscale using numpy and some Mathematics
An extremely magnified image at the end is just blocks of colors called pixels, where each pixel is formed by the combination of Red, Blue and Green, our primary colors. RGB color space or RGB color system, constructs all the colors from the combination of the intensities of Red, Green and Blue colors. The red, green and […]