Wednesday, May 18, 2016

[zcdyyenr] Canonical recursive pixel ordering

Cut the image in half orthogonal to the longer side.  If a square image, prefer a horizontal cut, inspired by the commonness of images processed in horizontal raster lines top to bottom.  If the length is odd, then make the right or bottom half the bigger half: coordinates therefore run 0 <= c < size/2 and ceil(size/2) <= c < size.

Recursively process the two halves, left right or top bottom.  Stop at a single pixel.

0 1 2
4 6 7
5 8 9

This is a kd tree with k=2.

Choices made: what to do if square, odd, left first, top first.  Create a tool to explore alternate choices, also including the possibilities of the dimensions (factorization) if one does not know it.

No comments :