It does not seem that you are using an array within the function, just its MAXIMAGES'th element. If that's the intent, just pass that single element of array as ofImage& img and then within the function use img variable instead of img[MAXIMAGES].
--8