omdenalore.satellite_imagery package
Submodules
omdenalore.satellite_imagery.find_resolution module
- omdenalore.satellite_imagery.find_resolution.resolution(input_tiff: str) Tuple[int, int]
Calculate the resolution of the given TIF file.
- Parameters
input_tiff (str) – Path to TIF file.
- Returns
resolution as a (x, y) tuple
omdenalore.satellite_imagery.geom_to_json module
- omdenalore.satellite_imagery.geom_to_json.geom_to_json(df: pandas.DataFrame, i: int) Tuple[ee.geometry.Geometry, str]
Converts shapefile or any geometry input into JSON format for GEE.
- Parameters
df – panda dataframe containing shapefile contents
i – integer value indicating which row in the dataframe to process
- Returns
Tuple of (JSON string, label)
omdenalore.satellite_imagery.preprocess_tiff module
- class omdenalore.satellite_imagery.preprocess_tiff.SatelliteImage(path: str, parts: int)
Bases:
object
SatelliteImage class is used to preprocess satellite images
- Parameters
path (str) – Path of the input .tif image
parts – Splits the single image into smaller images with
a total of (parts * parts) images returned :type parts: int
- Example
from omdenalore.satellite_imagery.preprocess_tiff import SatelliteImage >>> si = SatelliteImage( >>> path=”sample.tif”, parts=5 >>> ) >>> si.split()
- split() None
Splits a single .tif image into multiple parts in the same directory
This makes it easier for visualising and storing in memory compared to having a single large image
omdenalore.satellite_imagery.raster_summary module
- omdenalore.satellite_imagery.raster_summary.raster_summary(raster_dir: str, raster_file: str) None
Reads a raster file and outputs the metadata and image.
- Parameters
raster_dir – dir path location of the raster file
raster_file – raster file name
omdenalore.satellite_imagery.reprojecct_crs module
- omdenalore.satellite_imagery.reprojecct_crs.reproject_raster(rf: sphinx.ext.autodoc.mock.rioxarray.__qualname__, new_crs: str) sphinx.ext.autodoc.mock.rioxarray.__qualname__
Reproject the raster from a current CRS to a user specified CRS.
- Parameters
rf – (r)aster (f)ile sent for reprojection
new_crs – user defined new CRS projection
- Example
from omdenalore.satellite_imagery.reproject_crs import reproject_raster new_raster_object = reproject_raster(current_raster, ‘EPSG:4326’)
omdenalore.satellite_imagery.utils module
- omdenalore.satellite_imagery.utils.add_padding(image: numpy.ndarray, padding_height: int, padding_width: int, color: Tuple[int, int, int] = (0, 0, 0)) numpy.ndarray
Add padding around the image so that buildings touching the corners can be bought to center. Creates a new image of the desired size and color (black) for padding This is necessary as corner buildings will not be detected by contour detection algorithm if the building edges are outsite of the image
- Parameters
images – Image that you want padding around
padding_height (int) – Amount of padding in y direction
padding_width – Amount of padding in x direction
padding_width – int
color (1x3 tuple) – RGB color of the padding
- Returns
Image with padding
- omdenalore.satellite_imagery.utils.convert_pixels_to_geocoordinates(source_tiff_path: str, list_of_coords: List[Tuple[int, int]]) numpy.ndarray
This function convert pixel coordinates into geo coordinates according to the transform information inside the source tiff file
- Parameters
source_tiff_path – The source tiff file path from which the
bounding box was predicted. Tiff file should contain geo-transform information :type source_tiff_path: string :param list_of_coords: list of coordinates in the form of [(x1, y1)] :type bbox: List[List[int]]
- Returns
Numpy array
- omdenalore.satellite_imagery.utils.create_contours(coords: List[Tuple[int, int]]) numpy.ndarray
Converting the coordinates of the masks to numpy array
- Parameters
coords (List of lists) – List of Coordinates in the form the form of [(x1, y1)]
- Returns
list of contours in numpy format
- omdenalore.satellite_imagery.utils.zoom_to_fill(image: numpy.ndarray, mask: numpy.ndarray, padding_val: int = 0) numpy.ndarray
Use the mask of the object to center the object in the image and zoom to that object
- Parameters
image (numpy array) – Input Image
mask (numpy array) – Mask of the object that you want to center
padding_val – number of pixel padding to add around
the centered object :type padding_val: int
- Returns
Numpy image with centered object