I am trying to write a program to standardize an image which I need to better perform image classification. I found the definition of standardisation which is obtained simply by subtracting the mean pixel from every pixel, and then dividing by the standard deviation.
What I don't understand if this has to be done (1) component by component:
- Calculate mean alpha, alpha standard deviation, and then subtract the mean alpha and divide by the standard deviation of alpha, for every alpha component of every pixel
- Same for the RGB components
Or (2) value by value. Every pixel can be stored as an integer of 32 bits and I could calculate the mean and the standard deviation of every pixel intended as a 4 bytes integer, and do every of the above operations using 32 bits integers.
Both approaches produce different results but it's not clear to me which one is the most effective for image standardization intended as a way to get a better image classification algorithm.