pyotb: a pythonic extension of Orfeo Toolbox

Nicolas Narçon


pyotb

A pythonic extension of Orfeo Toolbox
Nicolas Narçon1, Rémi Cresson1, Vincent Delbar2

(1) INRAE, (2) La TeleScop


Firenze, FOSS4G - 25 Aug. 2022

Satellite image processing in Python

A basic example: Pansharpening

Challenges of remote sensing


in Python

What a Python developer goes trough

Searching for pansharpening

What a Python developer goes trough

Trying the pansharpening

What a Python developer goes trough

What a Python developer goes trough


Satellite image processing does not fit in RAM
Hard to find high-level Python Open Source remote sensing solutions

Pansharpening using pyotb

pyotb: remote sensing made easy

pyotb: remote sensing made easy

Fits in RAM
Many already implemented remote sensing solutions in Orfeo Toolbox
Easy to write

pyotb usecase

An usecase of pyotb

Goal: labeling the bare soils

An usecase of pyotb

Goal: labeling the bare soils

Conclusion

An easier way to use Orfeo Toolbox in Python
Takes advantage of the algorithms and efficiency of Orfeo Toolbox
Easy pythonic syntax
Easy to interact with Python processing libraries
https://gitlab.orfeo-toolbox.org/nicolasnn/pyotb/


		import pyotb

		# Pansharpening
		pxs = pyotb.BundleToPerfectSensor(inp='pan.vrt', inxs='xs.tif') 

		# Computing NDVI
		ndvi = (pxs[:, :, -1] - pxs[:, :, 0]) / (pxs[:, :, -1] + pxs[:, :, 0])

		# Computing a boolean raster to identify pixels without vegetation
		bare_soils = (ndvi < 0.3)

		# Creating a boolean cloud mask from the GML vector
		cloud_mask = pyotb.Rasterization('cloud_mask.GML', im=bare_soils)

		# Masking clouds (i.e. assigning to 0) on the result
		bare_soils_masked = pyotb.where(cloud_mask == 1, 0, bare_soils)
		bare_soils_masked.write('bare_soils.tif', pixel_type='uint8')
		  

Code sample