I’ve compared the matrix of eigenvectors resulting from:
otbcli_DimensionalityReduction -in CupriteCoarse.tif -out CupriteCoarsePCAotb.tif -method pca -method.pca.outeigenvalues eigv.csv -outmatrix eigenmat.csv
to results of PCA run with R (package RStoolbox) and HypPy3 (https://blog.utwente.nl/bakker/hyppy/)
Results from R and HypPy3 are much more alike than any of them compared to OTB.
I copy here the comparison subtracting the respective eigenmatrices (I use abs() because signs are arbitrary):
Comparing OTB to R:
> round(abs(otbeigenmat) - abs(Reigenmat),5)
1 0.02125 0.00017 -0.00009 0.00024 -0.00019 0.00012
2 0.00193 0.24181 0.00221 0.00201 -0.00065 0.00266
3 0.00042 0.00734 0.69122 0.00815 0.06338 -0.03435
4 0.00009 0.00490 0.02421 0.81131 0.11675 0.08478
5 0.00094 0.00511 -0.03584 0.09221 0.00714 0.86069
6 0.00056 -0.00010 0.06821 0.13170 0.92992 0.02208
Comparing OTB to HypPy3:
> round(abs(otbeigenmat) - abs(hypeigenmat),5)
1 0.02125 0.00017 0.00001 0.00001 0.00001 0.00002
2 0.00193 0.24181 0.00243 0.00164 0.00072 0.00087
3 0.00032 0.00712 0.69122 0.01296 0.02644 0.00047
4 0.00032 0.00528 0.01940 0.81131 0.10635 0.09612
5 0.00074 0.00375 0.00110 0.10261 0.00714 0.85866
6 0.00067 0.00169 0.03339 0.12036 0.93195 0.02208
Comparing R to HypPy3
> round(abs(Reigenmat) - abs(hypeigenmat),5)
1 0.00000 0.00000 0.00010 -0.00023 0.00020 -0.00011
2 0.00000 0.00000 0.00023 -0.00037 0.00137 -0.00179
3 -0.00010 -0.00023 0.00000 0.00481 -0.03694 0.03482
4 0.00023 0.00037 -0.00481 0.00000 -0.01040 0.01134
5 -0.00020 -0.00137 0.03694 0.01040 0.00000 -0.00203
6 0.00011 0.00179 -0.03482 -0.01134 0.00203 0.00000
I understand OTB uses the original image, without centering and/or scaling bands.
Unless there is an explanation, this is kind of worrying.
Agus