v2d

From v2c. I changed so it now outputs z (which is spatially averaged).
Should work for any number of pixels. Verified reproduces pixel 164
results.