Splitting up large geoTIFF orthomosaics
Doodler
can work with really large images, but it is usually best to keep your images < 10,000 pixels in any dimension, because then the program will do CRF inference on the whole image at once rather than in chunks. This usually results in better image segmentations that are more consistent with your doodles.
So, this post is all about how you make smaller image tiles from a very large geoTIFF format orthomosaic, using python. The smaller tiles will also be written out as image tiles, with their relative position in the larger image described in the file name, for easy reassembly
We'll need a dependency not included in the doodler
environment: gdal
conda install gdal
Now, in python:
How large do you want your output (square) image tiles to be? (in pixels)
What images would you like to chop up?
List the widths and heights of those input bigfiles
Specify a new folder for each set of image tiles (one per big image)
Make file name prefixes by borrowing the folder name:
Finally, loop through each file, chop it into chunks using gdal_translate
, called by an os.system()
command. Then moves the tiles into their respective folders