Crop Monitoring using Satellite Imagery — Part II
Image Processing
This is the 2nd article that continues about the study on Crop Monitoring using Satellite Imagery. This mainly focuses on the Image processing. To get a briefer understanding about the study, check out the previous article on the Introduction to the study performed.
Existing Methods
There are many APIs that provide the crop data & satellite data using the satellites that are currently orbiting the earth. We tried two main methods to collect the crop data to perform the Crop monitoring.
1. Generating the VI s using the provided Satellite Images
2. Generating the VI s directly from the API s that provide crop data.
The 2nd method is a direct one as it is basically generating the required VIs from the relevant API. And the relevant steps to generate them are clearly given in the relevant API documentations. Therefore, in this article we focus on the 1st method that is to generate the VIs using the Satellite Images.
Below describes on how we can generate the band values and calculate the required VI s. It also discusses on how much are these VI values correctly analyses the Images by comparing the values with the images generated.
Setting up the environment
Image processing requires a lot of RAM and storage as well. Therefore, for this study we have used the Google Collab platform.
Radiant ML Hub is the world’s first cloud-based open library/ repository dedicated for Earth observation training data to use with machine learning algorithms. Here we have used the Sentinel-2 dataset for Africa that is available in the ML Hub.
Below installs Python client for Radiant ML Hub API as we are using Python for the image processing.
Below commands imports all the required python libraries.
In the above code segment, you can enter the relevant API key to be stored as an environmental variable. The API key will be generated once we create an account under the relevant API.
Extracting the Dataset
Here we have used the African dataset. Therefore, the relevant name of the dataset provided in the Radiant ML Hub should be mentioned within the Dataset.fetch() function, so that it can be stored in the specified variable.
Then we create a folder where the extracted data should be stored and by downloading the dataset to the specified folder path, it can be extracted.
The extracted dataset is shown below,
Here the ‘source’ folder contains band data/ imagery related to each tile on a particular day.
Source file can be downloaded separately using the below code segment.
The downloaded files can be seen below,
Following shows some of the available dates for tile 02 in the extracted source.
Loading Images
First we should import the required modules from the python libraries needed for loading the images as shown below.
Next set the source path.
Then by setting the tile & date values accordingly we can generate the images relevant for that particular tile on that date.
By mentioning the specific file name relevant for the tile & date using the specified variables the images can be found and saved in the variable.
The above code segment shows only for the Blue (B02), Green (B03), Red (B04) and NIR (B08) band images. The same method can be used to get the other band images as well.
The Band names specified here correspond to the Satellite that is being used.
Next by specifying the equations related to the VIs the required images for the respective VIs can be generated. Few examples are given below from the loaded images of our study.
The RGB image using the red, green & blue band images.
NDVI image using the Red & NIR band images.
EVI image using the Red, NIR & Blue band images.
Here by specifying the vmax & vmin in the plt.imshow() function, the image can be viewed more clearly as the smaller values can be seen.
Image Analysis
The RGB image provides a brief understanding about the respective tile according to the amount of visible greenery. Therefore, the RGB image generated for the respective tile on a specific date can be compared with the value ranges of the VI images generated. Hence, it can be checked whether the values provided by the Indices generated & their meanings are correct for that tile. Even though the value ranges of different VIs produce proper results, there were some incorrect results as well. The main reason for this is the background, atmospheric conditions & other tiny interferences that effect on these Index values.
Conclusion
From this article you would have understood that by only generating the Vegetation Indices individually sometimes we would not get proper results. Therefore, the proper method that is to be followed is to consider NDVI which is the basic Index and then compare the results of the other Indices according to the NDVI value ranges. Indices like EVI have coefficients that can be set accordingly to get more accurate results.
For an example, if some sections of the image lie in the NDVI range (0.1–0.2) that says it is bare soil or the range (0.2–0.5) that says Sparse vegetation, then it can be further examined using the other indices such as SAVI by considering L = 1 for low vegetation & can be checked whether it gives the same results for the segment considered.
By using these comparisons, the images are able to be analyzed for more accurate results.
From this article you would have gained an understanding on how to use the VIs and their values to analyze the images. This concludes our study and approach on using Satellite images to generate better results on Crop Monitoring.