How to install Orfeo Toolbox for use with Python (Anaconda) on Windows
Orfeo Toolbox is a powerful open-source library for processing remote sensing imagery, produced by the National Centre for Space Studies (CNES) — the French National space agency. It is written in C++ with bindings for Python 3.5 and can also be used for processing within QGIS.
Anaconda is a Python Distribution used extensively for data science and geospatial applications.
Whilst the functionality of Orfeo Toolbox is excellent, the installation instructions aren’t overly comprehensive, so here are some more detailed instructions for setting it up for use with Conda on Windows:
(Assuming you are using the full Anaconda distribution and Pycharm as your IDE)
- Download and extract Orfeo Toolbox from: https://www.orfeo-toolbox.org/download/
2. Create a new Conda environment using Python 3.5 (newer version of Python are not currently supported at the time of writing).
3. Within the Pycharm terminal, activate the new Conda environment using:
conda activate environment_name
4. Run the
otbenv.batfile, found in the Orfeo Toolbox directory using the Pycharm terminal.
5. Check that this has set the Python Path correctly using
echo %PYTHONPATH% This should return a directory similar to the following:
6. You should now be able to import the Orfeo Toolbox for use in your Python scripts using:
import otbApplication as otb