I am trying to use SAGA_cmd to write a script that does the following: The united 1) Reads a series TIFF files I have in the work folder; 2) Runs a segmentation on the TIFF files on each respective file, and; 3) Outputs the corresponding shapefiles to a folder.
I have developed the following code based on examples from tutorials and searches online.
set PATH=%PATH%;C:\Users\PC\saga-4.1.0_x64 SET WORK=C:\Users\PC\Documents\MAP DATA\AERIAL PHOTOS\test FOR %%i IN ('dir /b %WORK%\*.tif') DO ( saga_cmd io_grid_image "Import Image (bmp, jpg, png, tif, gif, pnm, xpm)" ^ -OUT_GRID = %WORK%\%%~.sgrd ^ -OUT_RED="Band_1" ^ -OUT_GREEN="Band_2" ^ -OUT_BLUE="Band_3" ^ -FILE= %WORK%\%%i ^ -METHOD=2 ^ REM Tool: Object Based Image Segmentation saga_cmd imagery obia ^ -FEATURES= %WORK%\%%~ni_seg.sgrd ^ -NORMALIZE=1 ^ -OBJECTS=%WORK%\%%~ni.sgrd ^ -SEEDS_BAND_WIDTH=500 ^ -MAJORITY_RADIUS=500 ^ -POSTPROCESSING=1 ^ -NCLUSTER=100 ^ )
However, I get the following error:
-OUT_GRID is not recognized as an internal or external command, operable program or batch file."
I would like to find the source of this error or figure out how to rectify it.
Also, is it possible to use the tool chains in SAGA to automatically input multiple files, i.e. batch process.