Still, you should use Cython memory views, also you can make use of the fact, that img is C-contiguous; i.e. `double[:, ::1] img`