# V – Error Vectors

To conclude this section of the tutorial, I decided to save the best for last – error vectors. A more appropriate term would be an error matrix, but we’ll let it slide in this case, since the concept is can be explained in terms of either of the two.

Let’s say you have an input image, $I$, and you want to carry out an operation on it, $f$, such that:

• $I_{control}=f(I)$

Now let’s assume that you are attempting to recreate the the original function using a different algorithm. We will call this new function $g$. So, theoretically, if $g$ was implemented properly, both functions should yield the same output. We’ll assume that this is not the case, and that, due to an error in our code somewhere, the two functions do not produce identical output for the same input image, $I$. We will define the output of our experimental function, $g$, as:

• $I_{test}=g(I)$

Once we’ve calculated the test and control output images, we can compare them pixel-by-pixel to see if they produce the same output. This seems like an obvious technique, and some might wonder why I would bother putting it up here. An important note to remember is that some algorithms, especially iterative ones, do not generate the same output each time, even if the input data does not change between runs.

So, it would be nice if we could somehow have some sort of simple statistic to tell us “how different” our control and test images are. A simple and effective approach is to simply take the absolute value of the difference of the two images, store it in an image buffer itself, then calculate the sum of all pixel values. This value, the “error value”, can be used to assess how consistent your results are across runs.

I should also mention that for larger images, the error value can become very large. Make sure your error value doesn’t saturate or roll over!

Image, Altered Image, and Error Vector