MRG: Implement a function to compute mean img

This actually make the code of the examples significantly simpler.

Fixes #182