Image processing techniques have revolutionized the way we analyze and interpret satellite images. One of the fundamental tasks in geospatial analysis is extracting meaningful information from these images. In this article, we will explore the region_grow Python package and its capabilities for creating custom polygons from satellite images.
Installation
First, let’s install the region_grow package using pip:
python
pip install region-grow
Creating a New Polygon
To illustrate the usage of the region_grow package, let’s calculate a polygon for a sugar cane crop located in Boyaca, Colombia. We have a set of points near the crop, and our goal is to find the minimum polygon that covers the entire crop area using a small number of examples and a satellite image.
The input satellite image is a 3-band raster in GeoTIFF format. We will be using the Band 11 (Short Wave Infrared – I), Band 8 (Near Infrared), and Band 2 (Blue) for our analysis. The cell resolution of the image is 10m X 10m per pixel. Before proceeding, we perform a resampling process on Band 11 using a bilinear transformation.
The given points were taken at the sugar cane crop borders, with neighboring crops like yucca and corn, as well as non-crop areas like native forest. We aim to extract the sugar cane area, manually delimited, using the region growth algorithm.
The first step is to execute the algorithm to calculate the polygon using the similarity threshold method. This algorithm starts with the first given point and expands the region by scanning the 8 neighboring pixels. A pixel is chosen if its spectral reflectance is within the range of reflectance of the initial point. Once the approximate area is obtained, the algorithm recalculates the polygon, minimizing the difference.
python
rg.execute_with_area(
points_path=points_path,
raster_path=raster_path,
shape_path=shape_path,
classifier_tag="BD",
)
The result is a polygon that covers the sugar cane crop area. Take a look at the image below to visualize the generated polygon:
In this example, we have utilized the similarity threshold method, but the region_grow package provides other algorithms as well, such as using Euclidean distance or selection by confidence interval. These algorithms offer different ways to group pixels with similar spectral reflectance and extract polygons from satellite images.
To explore more examples and understand the code implementation in detail, refer to the provided notebook available in the examples/
directory of the region_grow repository.
In conclusion, the region_grow package is a powerful tool for extracting custom polygons from satellite images. It offers various algorithms for grouping pixels based on spectral reflectance, allowing you to customize the extraction process according to your requirements. This can be highly beneficial for applications like crop monitoring, land cover classification, and environmental analysis.
Leave a Reply