Help with understanding how to find mean of matrix

Hi all,

Just a quick background...I am working on a final year computer science project that performs face recognition. As part of the project I need to perform a lot of vector/matrix manipulation. Below is a small extract from the paper I am following...

http://i54.tinypic.com/dqornm.jpg

The problem I am struggling to figure is out how the mean/variance is calculated from the equation. For example a subject x who has three face images will be represented as a matrix of 3840 rows and 3 columns, where each value represents a colour and each column represents a single image. Now the end result is to get a single value of variance for each subject, however I am struggling to see how to convert this matrix into first a mean value and then a variance value. The divide part of the equation is 1/N where in this case N would be 3, but I was under the impression that to get the average you would divide by the total number of elements?

I apologise for the long-windedness of the explanation, however if you require any further information please ask.

Thanks in advance for and help you can offer

Tom