background computation

Added stubs for media of medians and preliminary (dumb) computation of
image background. Considering generic typing in order to avoid
proliferation of redundant code.