patrikhuber / eos

A lightweight 3D Morphable Face Model library in modern C++
Apache License 2.0
1.89k stars 596 forks source link

A question about "rescaled_pca_basis". #257

Open chengkeli opened 5 years ago

chengkeli commented 5 years ago

Hi,

I have one question about "rescaled_pca_basis" in the eos PcaModel class. I find when you initialize PcaModel, you will multiply the orthonormal pca basis with square root of eigenvalues. I didn't get the point why you implement in this way. For my understanding, it make sense that you rescale the basis with singular values. However, the singular values are not square root of eigenvalues as in the function:

"inline std::pair<Eigen::MatrixXf, Eigen::VectorXf> pca(const Eigen::Ref data, Covariance covariance_type = Covariance::AtA)"

The eigen value decomposition is applied on covariance matrix A'A/(N-1) so that the computed eigen values are 1/(N-1) times the square of singular values.

This means when you rescale the basis, there is an additional scalar sqrt(1/N-1) is applied on each basis in additional to singular value.

Would you please do me a favor to explain why you would like to introduce this scalar to rescale the basis?

Best regards, Keli.

patrikhuber commented 5 years ago

Hi @chengkeli,

Sorry for not getting back to you yet! Thanks a lot for this clear and detailed write-up. I am quite sure that I got it right when I implemented this in eos, as I've implemented it very carefully and double-checked every formula. But it is of course not impossible that I've made a mistake. I am really busy currently, but I do hope to find the time to have a look at it in more details. Apologies again that it's taking so long. Please let me know in the meantime if you were able to find out anything more.

Best wishes! Patrik