Poblem with PCA with dimensionality reduction

I need to do a PCA to reduce my number of features for a classification (40 indices radiometrics and texturals) on a vector polygons created from a segmentation.
Indices are calculates on vectors polygons (with zonal stat).

That I do next is :
o TrainDimensionalityReduction with train sample polygons to have a dimension of 10 features
o VectorDimensionalityReduction (with the model created previously) on training sample polygons, then all polygons from the zonal stat to reduces the number of features to 10

But my 10 fields created from VectorDimensionalityReduction all have the same value…
I don’t think it’s a bug from OTB, but maybe there is some problems in my process that I don’t understand.

Configuration setup

My system: *Windows11
Version of the OTB: 9.0
QGIS version: * 3.36

Hi Antoine,

Can you give us more details, ie parameters for the 3 applications : ZonalStatistics, TrainDimensionalityReduction, VectorDimensionalityReduction ?

I’m not an expert of these applications but I can try to reproduce it on simple use-case.

Best regards,


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…

Ok, thanks for your explanations. What I would do is to start with a simplier test, like trying to reduce your RGB features (mean + var : 6 parameters) into 2 dimensions.

Furthermore, I’m not sure it’s interesting to reduce in the same step spectral features (RGB, brightness, …) and spatial features (all texture indices).

Best regards,


Ok thx.
I have try with only r,g,b mean, or with some radiometric indices, and textural indices separately, with 2,3 or 5 pca, but all my pca fields have always the same values, for exemple :