Hello,
I wouldn't be worried about "the most efficient way" at this point.
Just get your image averaging down so you know it's working the way you want it to. Then graduate to refining your algorithm and code.
To start, if you're getting your images one at a time, you can just scale them by the number you want to average and add them, keeping a running total which will be your average upon completion.
For example, if I know I am going to average 3 values (say a, b, and c), and I get them "one at a time", I just keep a running total to compute the average in pieces as follows:
initial total value:
0
first iteration (recieve a):
new total value = previous value + a/3 = 0 + a/3
second iteration (receive b):
new total value = previous value + b/3 = a/3 + b/3
third iteration (receive c):
new total value = previous value + c/3 = a/3 + b/3 + c/3
Clearly and trivially you can see that the final result is the average of a, b, and c.
The reason I suggest it this way is that if you are receiving the images one at time, this way you only have to manage two arrays in memory - the "previous value" which is the running total, and the value you receive on that iteration.
You could just get all the images you want to average first, and then perform the average operation on them all at once, but then you have to store all the images you want to average at the same time. On the other hand, doing it this way would cause you to only have to perform a single division operation (add them all up and then divide), instead of performing the division on each piece separately. For a 2D array the division is performed on each element of course, but the idea still holds.
However, if you need to do weighted averaging at some point, then you'll have to do a "piece-wise" averaging anyway. Further, doing the average in pieces as suggested allows you to store less data in memory at a given time, but still compute the average as you receive your images - you just have to know how many you are receiving and want to average.
In LabVIEW, you can keep your "running total" in a shift register.
There are other ways to complete your task - precisely what is most efficient for you will really depend on how you are receiving the data - do you receive entire images at a time, or single pixels at a time, or multiple images at a time, or something inbetween those... that information will affect the optimal way to process it in addition to other factors (some discussed above, such as how many of a given computation type is required). Then there is optimization you can do in LabVIEW for memory and performance.
To round out this post, I suggest you pick something "reasonable" to start, and then refine later as needed.
I hope this helps!
Best Regards,
JLS