Blog

Online image processing with Orfeo Toolbox WPS

mercredi 01 Avril 2015 OTBWPSZOO



At GeoLabs we are keen on implementing WPS compliant web services. This time we are glad to introduce 50+ new services based on Orfeo Toolbox, and we show you how in this post.

Processing satellite imagery allows to extract meaningful information about objects or areas, and to create knowledge and value out of it. Simple to advanced open source algorithms are available for such purpose, and bringing them to the server not only promotes their wider use and adoption, but also opens door to better dissemination and sharing of the created value.

Following our standard oriented approach, think of one or several raster files that would be published as WCS (Web Coverage Service), given as input to a WPS service which would process them remotely for you, and finally output the results as a new WCS, WMS or WMTS service. It is now possible to implement such workflow using the latest version of the Open WPS Platform. Among other significant improvements, the upcoming ZOO-Project 1.5 release indeed introduces new optional support for Orfeo Toolbox (OTB).

OTB is a library of choice to process images from remote sensors like Landsat, SPOT or Pléiades. It is open source and ships with a set of ready-to-use tools for classical remote sensing tasks such as image manipulation, classification or segmentation, but also features extraction, change detection or hyper-spectral processing.

For our concern, we are taking advantage of the powerful OTB Applications. Each OTB Application is written once for all in a shared library (also known as plugin). This plugin can be auto-loaded into appropriate tools without recompiling, and is able to fully describe its parameters, behavior and documentation. Pretty awesome.

After investigating a bit more and with technical support from Rashad Mohammed (OTB team), we managed to load these shared libraries directly from ZOO-Kernel, the ZOO-Project WPS server. This basically adds 50+ additional WPS services to the usual GetCapabilities response (check it out !), and each service can be executed individually, but also possibly be chained with others.

Using the OTB Cookbook recipes, we can then send some interesting Execute requests to our WPS server. For example, the OTB Smoothing application applies either gaussian, mean, or anisotropic diffusion smoothing filter to an image, and so does our WPS service (OTB.Smoothing). We can execute it with this example WPS request:

//localhost/cgi-bin/zoo_loader.cgi?request=Execute&service=WPS&version=1.0.0&Identifier=OTB.Smoothing&DataInputs=in=Reference@xlink:href=//www.geolabs.fr/dl/Landsat8Extract.tif;out=float;type=anidif;type.mean.radius=2;type.anidif.timestep=0.1;type.anidif.nbiter=5&RawDataOutput=out@mimeType=image/tiff

Input Landsat image
Output smoothed image

In this first example, we process a small extract of a Landsat 8 scene, with the following parameters:

in
The input image file, here in GeoTIFF format ( Note that the xlink:href value could be a WCS request).
out
The output image type (it can be set to uint8, uint16, int16n, int32, float or double)
type
The smoothing type (it can be set to mean, gaussian or anidif )
type.mean.radius
The smoothing radius value in pixels (used in case the mean type was selected)
type.anidif.timestep
The Anisotropic Diffusion equation time step (used in case the anidif type was selected)
type.anidif.nbiter
The number of iterations which controls the sensitivity of the conductance term (used in case the anidif type was selected).

Another example right out of the OTB cookbook that demonstrates a more complex process is the OTB BandMath application which basically allows you to do maths with raster bands, as follow:

//localhost/cgi-bin/zoo_loader.cgi?request=Execute&service=WPS&version=1.0.0&Identifier=OTB.BandMath&DataInputs=il=Reference@xlink:href=//www.geolabs.fr/dl/verySmallFSATSW_nir.tif;il=Reference@xlink:href=//www.geolabs.fr/dl/verySmallFSATSW_r.tif;il=Reference@xlink:href=//www.geolabs.fr/dl/verySmallFSATSW.tif;out=uint8;exp=cos%28im1b1%29-%28-im2b1%29*im3b1-%28ndvi%28im3b3,im3b4%29%29&RawDataOutput=out@mimeType=image/tiff

For this example, we process the three images which are used in the OTB Band Math example, as shown bellow:

verySmallFSATSW_nir.tif
verySmallFSATSW_r.tif
verySmallFSATSW.tif

The three images are given as input to the OTB.BandMath service with the following parameters:

il
The list of input images (once again they could be accessed with WCS request instead of simple file link)
out
The output image type (it can be set to uint8, uint16, int16n, int32, float or double)
exp
The mathematical formula to compute

In this case, we are using the following expression:

cos(im1b1)+im2b1⋆im3b1-im3b2+ndvi(im3b3,im3b4)

A classified color ramp can finally be applied to the resulting GeoTIFF image for highlighting the extracted NDVI values, as shown bellow:

Output tiff
Classified output tiff
Classified output tiff on top of ortho

These basic examples demonstrate the use of the optional Orfeo Toolbox support now available in ZOO-Project. If you want to learn more about OTB and the ZOO-Project OTB support, join the OTB Hackfest in June. We will present our work in more details there. See you in Toulouse !

This work was supported by a grant from the European Union's 7th Framework Programme (2007-2013) provided for the project PublicaMundi (GA no. 609608).