CustomOrthoDataset is a child class of RasterDataset to load ortho images provided by the user
chip_orthomosaics() :
creates a dataset instance
sets the units accordingly to pixels/meters (CRS)
if tiles need to be saved -> create dataloader with the GridGeoSampler to ensure contiguous tiles. Save tiles as PNG images with the ToPILImage() function from torchvision that converts tensor to PIL images.
if tiles need to be visualized -> create dataloader with the RandomGeoSampler to visualize 'n' number of randomly (I though it's better to use random tiles for inspection rather than contiguous ones. Let me know if it is better to stick to just one type of Sampler.)
Further modifications to add:
Storing the metadata of tiles (CRS, transforms etc.)
Incorporate tile size/%overlap input argument
Regex specification for selecting files from the path
Changed to a single dataloader for saving and visualizing
meters-based CRS bug: I have implemented a function for converting the raster data to the reprojected CRS. If there is a simpler way to do this, please let me know. Note: This function has not yet been tested since I didn't have a lat-lon raster file with me.
Formatted, added docstrings
Added functionality to saved tile metadata as JSON files in the same path
In chip_ortho.py:
CustomOrthoDataset is a child class of RasterDataset to load ortho images provided by the user
chip_orthomosaics() :
Further modifications to add: