ENH Add normalization moments calculation

This achieves robustness against image scalings.
TST Test more memory accesses

In debug mode, this performs checks for memory access. In release mode,
it is optimized away to raw pointers.