weird behaviour of skimage.transform.rotate()

Johannes Schönberger jsch at demuc.de
Wed Nov 13 06:25:00 EST 2013


Hi,

it is working as expected. You are just dealing with a dtype issue here.

np.ones((30, 30)) => dtype=double with valid values between [0, 1] as a convention in skimage.

Replace np.ones((30,30)) with im_array = np.ones((30,30), dtype=np.uint8) and your issues should be fixed.

Hope it helps.

Am 13.11.2013 um 12:19 schrieb Sigmund <siggin at gmail.com>:

> Moin moin! 
> 
> (Enthought Canopy Python 2.7.3 | 64-bit | (default, Aug  8 2013, 05:30:12) [MSC v.1500 64 bit (AMD64)] on win32)
> 
> I noticed that the rotate function is not working correct for me or at least not in the way I expect it to function.   
> Could someone check this or tell me what I'm doing wrong. 
> I would like to rotate a image/array for some degrees. 
> 
> import numpy as np
> import matplotlib.pyplot as plt
> import skimage.transform as sk_trans
> im_array = np.ones((30,30))
> im_array[12,:]=2
> im_array[13,:]=3
> im_array[14,:]=4
> im_array[15,:]=5
> im_array[16,:]=4
> im_array[17,:]=3
> im_array[18,:]=2
> img_rot = sk_trans.rotate(im_array,45)
> plt.imshow(im_array,interpolation='none')
> plt.show()
> plt.imshow(img_rot,interpolation='none')
> plt.show()
> 
> 
> 
> 
> Thanks
> Siggi
> 
> -- 
> You received this message because you are subscribed to the Google Groups "scikit-image" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.




More information about the scikit-image mailing list