Why is skimage.transform.rotate significantly slower than PIL's Image.rotate? Why is skimage.transform.rotate significantly slower than PIL's Image.rotate? numpy numpy

Why is skimage.transform.rotate significantly slower than PIL's Image.rotate?


Install the latest version from https://github.com/scikit-image/scikit-image. Just a few days ago I fixed a bug (see https://github.com/scikit-image/scikit-image/commit/d5776656a8217e58cb28d5760439a54e96d15316) related to this slow down.

My numbers are as follows with the current dev version:

from PIL import Imageimport numpy as npfrom skimage.transform import rotatea = np.zeros((1000, 1000), dtype=np.uint8)im = Image.fromarray(a)%timeit im.rotate(10, Image.BICUBIC, expand=True)ima = a / 255.0%timeit rotate(ima, 10, order=1)%timeit rotate(ima, 10, order=3)## -- Output --10 loops, best of 3: 41.3 ms per loop10 loops, best of 3: 43.6 ms per loop10 loops, best of 3: 101 ms per loop


Having only read the Python code and not the Cython code for warp(), guess would be that since skimage is using generic warping code, its code paths are less efficient than something written specifically to do in-plane rotation and nothing else.