weird behaviour of skimage.transform.rotate()
![](https://secure.gravatar.com/avatar/0f2c41e836010745b862d3a9f95635ff.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/30da96bcd607693471ee5d45017717e9.jpg?s=120&d=mm&r=g)
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
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@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
![](https://secure.gravatar.com/avatar/0f2c41e836010745b862d3a9f95635ff.jpg?s=120&d=mm&r=g)
ahh, ok. And rotate() returns a float.
Thanks for the quick help!
On Wed, Nov 13, 2013 at 12:25 PM, Johannes Schönberger
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
: 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@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
-- 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@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
participants (3)
-
Johannes Schönberger
-
Sigmund
-
Sigmund Neher