%This returns a vector v with the number of changes pixels in each frame.
%It also returns a vector vabovemean with frames with below-average counts.
%fgArray is a boolean image containing white fg pixels and black bg pixels.
function [v, vbelowmean] = countFgPixels(fgArray)
    v = shiftdim(sum(sum(fgArray,2)),1);
    vbelowmean = (v < mean(v)) .* v;
end
