For zonal stat, it’s simply to have mean/med of each raster index for each training polygon.
Here my parameter to the 2 other treatments:
processing.run(“otb:TrainDimensionalityReduction”, {‘io.vd’:‘D:/test_otb/sample/sample_cut_segments_train.shp’,‘io.out’:‘D:/test_otb/pca_train.txt’,‘io.stats’:‘’,‘feat’:[‘meanB0’,‘meanB1’,‘meanB2’,‘varB0’,‘varB1’,‘varB2’,‘bright_mea’,‘bright_med’,‘hrfi_mean’,‘hrfi_media’,‘myd_mean’,‘myd_median’,‘sfstext1_m’,‘sfstext1_1’,‘sfstext2_m’,‘sfstext2_1’,‘sfstext3_m’,‘sfstext3_1’,‘sfstext4_m’,‘sfstext4_1’,‘sfstext5_m’,‘sfstext5_1’,‘sfstext6_m’,‘sfstext6_1’,‘haralick1_’,‘haralick_1’,‘haralick2_’,‘haralick_2’,‘haralick3_’,‘haralick_3’,‘haralick4_’,‘haralick_4’,‘haralick5_’,‘haralick_5’,‘haralick6_’,‘haralick_6’,‘haralick7_’,‘haralick_7’,‘haralick8_’,‘haralick_8’],‘algorithm’:‘pca’,‘algorithm.pca.dim’:10})
processing.run(“otb:VectorDimensionalityReduction”, {‘in’:‘D:/test_otb/sample/sample_cut_segments_train.shp’,‘instat’:‘’,‘model’:‘D:\test_otb\pca_train.txt’,‘out’:‘D:/test_otb/train_pca.shp’,‘feat’:[‘meanB0’,‘meanB1’,‘meanB2’,‘varB0’,‘varB1’,‘varB2’,‘bright_mea’,‘bright_med’,‘hrfi_mean’,‘hrfi_media’,‘myd_mean’,‘myd_median’,‘sfstext1_m’,‘sfstext1_1’,‘sfstext2_m’,‘sfstext2_1’,‘sfstext3_m’,‘sfstext3_1’,‘sfstext4_m’,‘sfstext4_1’,‘sfstext5_m’,‘sfstext5_1’,‘sfstext6_m’,‘sfstext6_1’,‘haralick1_’,‘haralick_1’,‘haralick2_’,‘haralick_2’,‘haralick3_’,‘haralick_3’,‘haralick4_’,‘haralick_4’,‘haralick5_’,‘haralick_5’,‘haralick6_’,‘haralick_6’,‘haralick7_’,‘haralick_7’,‘haralick8_’,‘haralick_8’],‘featout’:‘prefix’,‘featout.prefix.name’:‘pca_’,‘pcadim’:10,‘mode’:‘overwrite’})
I don’t use statistics file beacuse it’s don’t work, in my case, my image (necessary to create stats) is just an RGB, and fields that I have comes from 12 differents rasters that represent each textural or radiometric indices…