Skip to content
Snippets Groups Projects
Commit e3cdcd21 authored by santipe83's avatar santipe83
Browse files

DOC: remove previous version of otb app python merged now in apps-python

parent b1057978
No related branches found
No related tags found
2 merge requests!2Otb app python,!1Otb app python
** The Orfeo ToolBox Application mechanism :slides:
*** Data and Objectives
**** Objectives
- Know how to set the environnement to use OTB application in Python
- Know how to set application parameter in Python
- Know how to use in memory connection of applications
- Know how to use OTB/NumPy bridge.
**** Data
Data can be found in folder ~Data/otb-python/~.
*** Outline
This exercise consists in coding a Python script to perform surface water
extraction on Sentinel-2 images over the area of /Laguna la nina/ in Peru.
#+begin_center
#+ATTR_LaTeX: width=0.95\textwidth center
[[file:Images/lluvias-peru.jpg]]
#+end_center
(Twitter pic from @hombredeltiempo)
*** Quick introduction to OTB applications
- Orfeo ToolBox is a *library* offering remote sensing features
- Often several features of OTB must be combined within a processing chain
- Need for higher level interfaces (parameters, input and output data, logs ...)
- Each application corresponds to a high level function (segmentation, orthorectification, raster calculator ...)
- And corresponds to a C++ class (/otb::Application/) $\rightarrow$ library
- Plugin mechanism
- One can develop and distribute his/her own homemade applications
*** OTB applications in Python
- Library called *otbApplication*
- 2 main classes can be manipulated:
- Registry: list available applications (or create some)
- Application: base class for all applications (interact with an
application
- Example:
#+begin_src python
import otbApplication
orth=otb.Registry.CreateApplication("OrthoRectification")
#+end_src
*** Syntax
- Getters
#+begin_src python
app.GetParametersKeys()
#+end_src
- Setters
#+begin_src python
app.SetParameterString("in", argv[1])
#+end_src
- How to launch an application
- Execute() -> wire the pipeline
- ExecuteAndWriteOutput() -> wire the pipeline and write output
*** Syntactic sugar
- Instead of:
#+begin_src python
ExtractROI.SetParameterInt('startx', 140)
#+end_src
- Use:
#+begin_src python
ExtractROI.STARTX=140
#+end_src
- Upper case is mandatory for now
*** In-memory connection
- Applications are often use as parts of larger workflow
- Heavy I/O operations generally in remote sensing image processing
- Connect output parameter from app1 to the input parameter of app2
- Available both in C++ API and Python
- Related to ITK/OTB streaming mechanisms
*** NumPy bridge
- Plug OTB into any image processing chain in Python
- Use etImageFromNumpyArray() and SetImageFromNumpyArray() methods
*** Useful links
- [[https://www.orfeo-toolbox.org/CookBook/OTB-Applications.html][Introduction to OTB applications]]
- [[https://www.orfeo-toolbox.org/CookBook/Applications.html][Application Reference Documentation]]
- Application help: /otbcli\textunderscore{}XXX -help/
** Utiliser les applications OTB en Python (TODO) :slides:
*** Objectifs et données
**** Objectifs
- Savoir configurer l'environnement pour utiliser les applications en Python
- Savoir paramétrer une application OTB en Python
- Savoir utiliser la connexion en mémoire entre applications
- Savoir utiliser le /bridge/ entre OTB et NumPy
**** Données
Les données se trouvent dans le répertoire ~Data/otb-python/~.
*** Déroulement
Le TP consiste à mettre en place un script Python pour réaliser l'extraction
des surfaces en eaux dans une série d'images Sentinel-2 sur le zone de
/Laguna la nina/ au Pérou.
#+begin_center
#+ATTR_LaTeX: width=0.95\textwidth center
[[file:Images/lluvias-peru.jpg]]
#+end_center
(photo Twitter de @hombredeltiempo)
*** OTB-Applications en Python
#+begin_src python
import otbApplication
orth=otb.Registry.CreateApplication("OrthoRectification")
#+end_src
*** Liens utiles
- [[https://www.orfeo-toolbox.org/CookBook/CookBookse1.html#x7-60001.1][Introduction aux OTB applications]]
- [[https://www.orfeo-toolbox.org//Applications/][Documentation de référence des applications]]
- [[https://www.orfeo-toolbox.org/CookBook/CookBookch3.html#x38-370003][Exemples utilisation des OTB applications]]
- Aide d'une application: /otbcli\textunderscore{}XXX -help/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment