Apply masks on Satellite Images
When we use Satellite Imagery, they usually provide masks for clouds, water, etc. I will show you how to apply masks to remove water pixels from satellite images.
About Dataset
Context
A collection of water bodies images captured by the Sentinel-2 Satellite. Each image comes with a black and white mask where white represents water and black represents something else but water. The masks were generated by calculating the NWDI (Normalized Water Difference Index) which is frequently used to detect and measure vegetation in satellite images, but a greater threshold was used to detect water bodies.
Link: Satellite Images of Water Bodies
Example:
Desired output like this:
Now, we start:
1. Load Libraries:
import numpy as np
import os
import matplotlib.pyplot as plt
from scipy import stats
import rasterio
from rasterio.plot import…