Average image over $N$ frames with one frame buffer
Don't fully understand the question; your formula already describes your solution:


Take the first frame into your framebuffer
For every pixel of the second frame, add it to pixel at the same position in the frame buffer.
Repeat 2. for the rest of your frames.
Multiply every pixel of the resulting frame by $\frac1N$. 


Done!

(Note: depending on the data type, might be advantageous to multiply every pixel with $\frac1N$ before addition/move to the framebuffer pixel)