BUG Fix Sobel filtering on newer numpy versions

Some slight change in recent numpy versions triggered dodgy code in
sobel(). Curiously enough, Matlab seems to also not behave consistently
across different versions and output very different results with minor
differences in the input.