Cleanup and use of transform.integral_image in _mean_std.