Closed pyaada closed 3 months ago
https://rasterio.readthedocs.io/en/stable/api/rasterio.features.html#rasterio.features.shapes can extract connected shapes from an array and returns shapely polygons that can be converted to geojson or a shapefile.
To add on to that, unfortunately we don't have an easy way to do it, you would need to reference the original JP2 or GeoTIFF to transform the pixel values detected from the numpy array back to georeferenced coordinates. But the numpy/JP2 should match up so it should be possible to do this transformation.
I am following the custom inference document to apply the pretrained Solar Farm model on Sentinal 2 Imagery. The model inference works as expected, however, I am losing information when I convert the georeferenced jp2 image I get from Sentinal to a tif file and then to a numpy array. I want to export the output masks as a raster or shape file. What would be the easiest way to achieve this?