I download otb 9.0 win64.zip in your website.
and i set the folder path in qgis3.34
it seems the otb in processing is ok
while if I want to process some data not in gui, just with python call the for example edgeextraction what should i do?
My system*: *Windows10
Version of the OTB: 9.0?
I find some code in the internet, while I feel I have to no way to add the otb algorithm in python.
for alg in QgsApplication.processingRegistry().algorithms():
print(alg.id(), “->”, alg.displayName())
it could print the algorithm in qgis including gdal native and qgis
just like this
qgis:variabledistancebuffer → Variable distance buffer
qgis:vectorlayerhistogram → Vector layer histogram
qgis:vectorlayerscatterplot → Vector layer scatterplot
the code is just like this
from qgis import processing
from qgis.core import QgsProject, QgsProcessingFeedback
Initialize feedback for processing
feedback = QgsProcessingFeedback()
Define the parameters for the OTB tool
params = {
‘INPUT’: ‘path/to/your/input/image.tif’, # Input image path
‘OUTPUT’: ‘path/to/your/output/image.tif’, # Output image path
# Add other parameters specific to the OTB tool here
}
Specify the OTB algorithm you want to use (e.g., ‘otb:ImageFilter’)
algorithm = 'otb:EdgeExtraction ’
Run the OTB processing algorithm
result = processing.run(algorithm, params, feedback=feedback)
Optionally, add the output layer to the QGIS project
QgsProject.instance().addMapLayer(result[‘OUTPUT’])
READ ME FIRST
The Usage category is meant to discuss about OTB usage. You are welcome to ask questions about OTB installation and compilation, OTB applications, OTB Python environment, OTB-QGIS plugin, and other topic related to the Orfeo Toolbox.
Before posting, please:
- look for similar issues on this forum. For example, you could search for the error message you get, or the name of the application you are using.
- If you did not already, consider searching / reading the CookBook.
- Take the time to say Hi, and be friendly
In order to receive the help you need, you will have to give us some information and details about the context and what you are trying to achieve. To assist you in the writing of you question, use this template, and replace the texts written in italic with what correspond to your situation.
After reading and understanding this, you may delete that part of the text
Context
Explain briefly what you are trying to do
Configuration setup
My system: Windows10, macOS, Debian 9?
Version of the OTB: 7.1/8.0?
I installed the OTB with: the binaries, the Debian package management, the SuperBuild, other?
If relevant, you may also provide:
QGIS version: 3.10.8, 3.14?
Python version: 3.5, 3.8?
Description of my issue
This is where you give details on what you are trying to achieve, describe the different steps you took, and the results you obtained. Don’t hesitate to share input parameters, logs and error messages, ether with a text file or a screenshot, or directly included using backticks like this:
My error message