Mean of a pixel value
<p>I am trying to understand the theory behind my method that calculates the mean colour value of an image.</p>

<p>I am using java's Color class and accessing the pixels and retriving their RGB values. Each pixel can be thought of as a vector. The vector has a red value, a green value and a blue value. When finding the mean of the red pixels in an image using getRed(). Does the method access a pixel, calculate the mean of the three colours in the vector and return that as the mean value for that pixel, then move on to the next pixel and do the same until it has accessed all the pixels and then find an over all mean of the pixel values summed divided by the total number of pixel values?</p>

<p>OR</p>

<p>Does getRed() simply sum the three features in the vector and return the total and move on to the next pixel and do the same. Before dividing by the total pixel value.</p>

<p>so, as an example:</p>

<p>is it:</p>

<p>((R+G+B)/3) + ((R+G+B)/3) + ((R+G+B)/3) + ((R+G+B)/3) + ((R+G+B)/3)) / 5</p>

<p>OR</p>

<p>((R+G+B)) + ((R+G+B)) + ((R+G+B)) + ((R+G+B)) + ((R+G+B))) / 5</p>

<p>Thanks in advance</p>