%Given an array of images, this function will compute and return the background image.
%The only assumption is that the last dimension indexes images, not pixels or colors.
function [bgImg] = computeBackground(imArray)
    %In this project, we simply mean together the images.
    bgImg = mean(imArray, ndims(imArray));
end