# Homography transformations

Homography is defined as mapping between two different projections of an image and is represented by a 3x3 transformation matrix in a homogenous coordinates space. We can use this to transform an image through a combination of rotation, translation, scaling, or skew operations. Let’s use this chess board as an example:

The image above was taken in an angle where it appears to be slanted. Let’s try to make it on top-view:

`src = np.array([391, 100,                14, 271,                347, 624,                747, 298,]).reshape((4, 2))…`

# Segmenting an image: An Image Processing Introduction

Image segmentation is the process of partitioning an image into several segments or extracting a specific part or information of an image. For this article, I will discuss how we would be able to segment the image using two kinds of color segmentation: RGB and HSV, and also via image differentiation.

# Color segmentation

It is possible to segment images based on their color via RGB and HSV. Depending on which segmentation technique you will use, you will be able to extract a specific segment of the image as long as it is colored. Let’s use this colored balls for this one:

Let’s…

# Detecting blobs and connections using Python: An Image Processing Introduction

Blobs are pixels that are grouped or connected together that share common properties in an image. Blobs may take different kinds of objects In this article, we will attempt to correctly detect these blobs using this image:

Our aim is to be able to detect the coins correctly. In order to do this we need to transform the image into a binary format since blobs could be identified as bright areas in a dark background or vice-versa.

`from skimage.io import imread, imshowfrom skimage.color import rgb2grayim = rgb2gray(imread(‘coins.jfif’))im_bw = im < 0.85imshow(im_bw)`

# Filtering and morphing of digital images using Python: An Image Processing Introduction

Digital images could not only be enhanced, but could also be filtered or morphed. In this article, I will discuss two ways: spatial filters and morphological operations

# Spatial filters

Spatial filters are matrix filters that are applied on an image using convolution. There are different kinds of spatial filters that could be applied in an image, however I will only discuss two spatial filters: horizontal and vertical sobel filters. Let’s use this image again:

`import matplotlib.pyplot as pltfrom scipy.signal import convolve2dgp_bw = rgb2gray(imread('guinanpicard.png'))## Applying Horizontal Sobel Filter## Horizontal Sobel Filterkernel1 = np.array([[1, …`

# Enhancing images using Python: An Image Processing Introduction

In my previous article, I discussed how we could a little bit more understand a digital image using Python. Now I will discuss how we will be able to enhance digital images still using Python via White Balancing and Histogram Manipulation.

# White Balancing

White balancing is a method where we correct a digital image by turning white or neutral colored regions appear white in a digital image. I will discuss three algorithms of white balancing: white patch, gray world, and ground-truth. For the sake of simplicity, let’s reuse the image from my previous article:

## White patch algorithm

This algorithm normalizes each color channel depending on…

# Understanding a digital image using Python: An Image Processing Introduction

In this article, I will discuss how could we do basic digital image processing using Python and extract information from images.

It is known that digital images are digital representations of images and are usually represented as n-dimensional matrix values called pixels. Let’s try it in this “futuristic” image of Guinan and Captain Jean-Luc Picard of the USS Enterprise (yes, because I am a Star Trek fan) and extract its pixel values:

`## Import the image using imreadguinanpicard = imread(‘guinanpicard.jpg’)guinanpicard## Output of guinanpicard array([[[ 73, 81, 156], [ 73, 83, 154], [ 67, 80, 148], ..., […` 