Switch bg/fg to use meanFrame instead of medianFrame for perf reasons