How to standardize the data matrix before applying SVD for PCA?

I am trying to enhance the contrast in the images I get after scanning a surface using Thermography (Principal Component Thermography ~Rajic, which is basically an application of Principal Component Analysis) to see the defects clearly.

I have some 20 images and all having 180*180 pixels. I am following a paper in which they first put each image in a column and it forms a matrix of 32400*20 as shown in the figure below. SVD is used to decompose matrix A into U, R, and V.

But before applying PCA you have to standardize the matrix and they are doing it according to these equations. I have two Questions here;

1. In PCA, do we have to always center rows (i.e. subtract mean from each row) or we have to actually center our variables(=pixels of an image) which can be along a row or column depending how we put our sample (=images) in the matrix A. Or it depends on what we are actually trying to do? It means in some cases.

2. And the standard deviation equation mentioned here, isn't it wrong (I think we should be subtracting mean of row not column here? Also I have the same question that does the standard deviation should be along row or column in this case.

• I don't understand the premise of your question (2): $\mu_m$ clearly is the mean of row $m$ as shown in the preceding figure. – whuber Jul 6 '17 at 18:57
• (1) One normalizes each variable. (2) In this cases variables are in rows, and so rows are normalized. That's all. – amoeba Jul 6 '17 at 19:09
• @whuber In (2) I am asking about standard deviation and am referring to the $\sigma_m^2$ equation. I though it should be $\sigma_m^2 = 1/(N-1) \sum_{n=1}^N (A(m,n) - \mu_m)^2$ instead of $\mu_n$ in this equation? – Rumi-Thermo Jul 7 '17 at 3:43
• @amoeba If I try to elaborate your answer; As each pixel of an image is a variable here and images are in columns. So along a single row we have multiple samples (observations) of a pixel (variable), hence if we want to normalize a pixel (variable) we should take mean of all the sample values of it and subtract it along the row. Am I right? – Rumi-Thermo Jul 7 '17 at 4:46
• Yes, that's exactly what I meant. You are right, there is a typo in the last equation, it should be \mu_m. – amoeba Jul 7 '17 at 5:15