Pollution Control by Identifying Potential Land for Afforestation – Python Project
The program aims at controlling the pollution in a given area by suggesting the number of trees and the areas where they should be planted. The heart of the program is Computer Vision. A sample image is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using the Python language.
Tools and Technology used
In this project, we are using numpy and maths for calculation of our surrounding areas, PIL(Python Imaging Library) for manipulating. Before jumping to the project let’s understand these terms.
- NumPy (Numerical Python): NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays.
- Maths: The Python math module offers you the ability to perform common and useful mathematical calculations within your application. Here are a few practical uses for the math module: Calculating combinations and permutations using factorials. Calculating the height of a pole using trigonometric functions.
- PIL(Python Imaging Library): Python Imaging Library is a free and open-source additional library for the Python programming language that adds support for opening, manipulating, and saving many different image file formats.
- OpenCV: OpenCV is a cross-platform library using which we can develop real-time computer vision applications. It mainly focuses on image processing, video capture and analysis including features like face detection and object detection.
Step by Step Implementation
Step 1: Create a New Project
Create a new project in PyCharm IDE or V.S. Code
Step 2: Before going to the coding section first you have to do some pre-task
In this project, we need an API key provided by Google Maps.
Step 3: Let’s code Map segmentation
The satellite image generated by the 1st step undergoes Image segmentation, which separates all the objects in the image by focussing on edges and boundaries. The image is divided into objects such as buildings, trees, water bodies, roads, barren land, etc. Our first algorithm of choice is Mean Shift Algorithm for segmentation.
Step 4: Let’s code for place lookup
The user is required to input the name of the area, on which the program has to be executed. The satellite images of that area will be scraped and are zoomed such as to generate a clear image of the map on which image segmentation can be done.
Step 5: Let’s code calculate area
We will be finding the pollution level of the given area. According to that level, we will find the number of trees required to bring that particular level to normal. In this process, we need to train a Classifier that can identify the buildings, the trees, and most importantly, the free land. The Zernike moments used by the above method will be used as features for these segments. The classifier is trained with labels as ‘buildings’, ‘trees’, ‘water’, ‘free land’, and ‘roads’. After the training, we only need to find the part coming under the ‘Free Land’ label.
Step 6: Let’s code main file
This is how the complete project structure looks like.