Part 4-Area of Interest

Kumar Brar
3 min readFeb 8, 2020

Till now, we have learnt about specific areas of Computer Vision related to Gaussian Blur and Canny images. In this article, our focus will be to take out the area from the image in which we are interested and eliminating all other unnecessary image data. This will help us to focus only on the limited area and hence limited data points.

You all know that it is always necessary to filter out the unwanted data points; not only from the view of performance but also to reduce unnecessary computations on unwanted details.

Our canny image looks like the one shown below :

Canny Image

Now, in this image we are interested only in a specific region as shown below :

Area of Interest

So, first of all we need to know about the coordinates of the image and hence find out the coordinate points, in which we are interested. This can be done with the help of matplotlib library as it shows an image along x and y axis; which helps to locate the coordinate points. The result is shown below:

Image with coordinate details

The vertical axis is y-axis and the horizontal one is the x-axis.

From the image, you can easily understand that we are interested in a specific area starting from (200,0) , (1100,0) and (550, 250). When we plot these points on the image, you will see the points as shown :

Points plotted on the image

Once we connect these points, we get our Area of Interest as shown :

Area of Interest

We will make use of the mask function, in order to create a copy of the above Area of Interest by copying the image. Now, the masked image will have the same image data as our original image; with the exception that everything is a collection of zeros or you can say a totally black image. But in order to show, the Area of Interest, we will fill the traced polygon with Area of Interest with white (255- color code for white) in the image and will get the desired Area of Interest as shown :

Area of Interest(Below) extracted from Original Image with coordinate details(Above)

The mask function helps us to get the output we require:

Area of Interest

In the next article, we will move ahead with this project of Finding Lane Lines and study about some other important topics.

Bibliography

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.mask.html

https://www.geeksforgeeks.org/python-pandas-dataframe-mask/

--

--

Kumar Brar

I am a lifelong learner with an ongoing curiosity to learn new things and share them with others. This helps in brainstorming and implementing new ideas.