How would you store a pyramidal image representation in Python?
<p>Suppose I have N images which are a multiresolution representation of a single image (the Nth image being the coarsest one). If my finest scale is a  16x16 image, the next scale is a 8x8 image and so on.
How should I store such data to fastly be able to access, at a given scale and for a given pixel, its unique parent in the next coarser scale and its children at each finest scale?</p>

<p>You could just use a list of numpy arrays. Assuming a scale factor of two, for the <em>i,j</em><sup>th</sup> pixel at scale <em>n</em>:</p>

<ul>
<li>The indices of its "parent" pixel at scale <em>n-1</em> will be <code>(i//2, j//2)</code></li>
<li>Its "child" pixels at scale <em>n+1</em> can be indexed by <code>(slice(2*i, 2*(i+1)), slice(2*j, 2*(j+1)))</code></li>
</ul>

python numpy image-processing