The word intersection in mathematics is termed as the similar (smaller) objects between two different objects. Intuitively, we can say the intersection of objects is that it belongs to all of them.

Geometrically speaking, if we have two distinct lines (assuming these lines are two objects), the intersection of these two lines would be the point where both the lines meet. Well, in the case of parallel lines, the intersection doesn’t exist. Geographically, the common junction between two or more roads can be taken as the area or region of intersection.

In Set theory, the intersection of two objects such…

In the previous articles on morphological transformations, we learned the two important transformations namely erosion and dilation. In this article, we will implement the other transformations which are built on top of these two. They are -

- Opening
- Closing
- Morphological Gradient
- Top hat
- Black hat
- Boundary Extraction
- Hit — Miss Transformation

We have seen a step-by-step implementation of erosion and dilation explaining the convolution method with simple matrix operations. In all of these transformations, we rely on the binary input image, structuring element, or kernel. The structuring element needs to be a square matrix which is again a binary matrix.

Like Image Erosion, Image Dilation is another important morphological operation used to increase or expand shapes contained in the input image. Think of this as **“ diluting ”** the image. Diluting anything requires water, here we need a structuring element or kernel.

**Note**: We are not expanding or increasing the image size. We are increasing the pixel strength and the size remains the same.

Mathematically, we can represent this operation in the following way -

Erosion operation is one of the important morphological operations (morphological transformations) that follows a technique of `mathematical morphology`

for the analysis and processing of geometrical structures.

To get a general idea of what erosion has to do with images, we can think of this as an operation in which it tries to reduce the shape that is contained in the input image. It is just like the erosion of soil but just that this operation erodes the boundaries of the foreground object.

To represent this operation mathematically, we can have -

A⊝B

where -

`A`

→ Input Image`B`

→…

Image shifting is simply shifting each pixel of the image to a new position. This is a method of pixel shift used in digital cameras to produce super-resolution images. We can think of a pixel as a point in the coordinate axis to be shifted in any direction. When we implement this on all the pixels of the image then we can say the image is shifted.

In this blog article, we will try to shift the image as we shift the point in the coordinate axis completely using NumPy operations. The image is always considered as a `2D`

plane…

Earthworms are the soil engineers that help plants to thrive.

The importance of earthworms was not known to the farmers in the earlier days. Farmers used to eliminate these worms thinking that they would harm the crops. Thanks to the agricultural researchers who made the knowledge available and said that these worms were not spoiling the crops but helping them flourish.

Often times the soil of the plant pot hardens when not watered occasionally. This can jam the roots of the plants and thus roots get spoiled. If we are using red soil for gardening, occasionally we need to water…

Nature is the Nurturer of Life.

During the lockdown, my family and I started terrace gardening. If you didn’t know already — it’s a gardening technique where plants are grown on top of the house. The plants are provided the requirements they need on the terrace. Anybody can start terrace gardening without any prior knowledge. The only required thing is the interest in gardening and love towards plants.

Firstly, we did not have a plan of making a terrace garden rather we started just by growing small plants like — Mint, Coriander, and some Veggies. We planted them in small…

In this article, we will try to understand the inner working of ** cv2.rectangle()** using the NumPy module in Python.

The ** cv2.rectangle()** is OpenCV’s method — used to draw a rectangle on the image. We have options to decide the thickness and the color of the rectangle. But we need to make sure that the color is passed in

A rectangle is simply a shape that we would like…

In this blog article, we will learn how to crop an image in Python using NumPy as an ideal library. When we talk about images, they are just matrices in 2D space. And of course, it depends on the image, if it is an **RGB** image then the size of the image would be (width, height, 3) otherwise — grayscale would just be (width, height). But ultimately, images are just large matrices where each value is a pixel positioned row-wise and column-wise accordingly.

Cropping the image is just obtaining the sub-matrix of the image matrix. The size of the sub-matrix…

In this article, we will learn how to invert an image using NumPy. To get some gist of this, let’s we have two values **0** and **1**. Here **0** represents **Black** and **1** represents **White**. When we apply inversion to these values, we get:

- 0 → inversion → 1
- 1 → inversion → 0

The above only works when we two values. **0** for **low** and **1** for **high**. If we were to relate the same with the **Binary Image** whose pixel values are just 1’s and 0's. The inversion would be reversed. …

Python Developer | Python Mentor | Aspiring Geo Data Scientist | Support me: https://www.buymeacoffee.com/msameeruddin