5

I have experienced very strange problem related to scikit-image. Namely, I'm not able to run "started example":

from skimage import data, io, filter

image = data.coins() # or any NumPy array!
edges = filter.sobel(image)
io.imshow(edges)

After that Python 2.7 reports Error:

ValueError: can not convert object to float64.

Moreover, I am not able to open any "tif, png" images, because Python reports similar error. Interestingly, this problem appeared suddenly, because at the beginning everything was working correct.I suppose this was due to instalation of pymorph module which probably affected numpy. However, do You have any ideas how to solve this problem?

AS_Python
  • 51
  • 1
  • 3
  • Can you tell me what the output of data.coins() is? – Stefan van der Walt Apr 28 '14 at 14:50
  • So, data.coins() doesn't produce any output. If I check the type of "data.coins()" (using .dtype) I obtain "object" (not numpy as expected). – AS_Python Apr 28 '14 at 15:06
  • That's very odd; can you try the following: ``from skimage import io; io.use_plugin('matplotlib')`` and then repeat the above experiment? – Stefan van der Walt Apr 28 '14 at 17:22
  • Yes I was trying this trick, however it still doesn't work. I think that pymorph plugin was involved in this mess among my plugins, and so something bad happened with numpy. I suppose that the best solution from this peculiar (not reported by anybody in stackoverflow) situation is to simply reinstall the whole python, though it is the worst solution. Nevertheless, If You have any other ideas i will be glad. – AS_Python Apr 28 '14 at 19:16
  • Does ``io.use_plugin('pil')`` give the same results? – Stefan van der Walt Apr 28 '14 at 23:09
  • Unfortunately, yes. Python still reports the same error. I have found that everything, except for loading images from external files, works fine. I would like to note that before instalation of pymorph module (handson) everything was working correctly. Doy You think it may be caused by conflict between numpy (.dtype reports this error) and pymorph? – AS_Python Apr 29 '14 at 05:48
  • It shouldn't be--I can't imagine what pymorph would have changed on your system. Can you try loading images using matplotlib directly, i.e. ``import matplotlib.pyplot as plt; plt.imread('myimage.png');`` – Stefan van der Walt Apr 29 '14 at 11:59
  • Thank You, It works ;-). I have used your first advice based on io.use_plugin('matplotlib') and plt.imread('myimage.png');. Now everyhing is OK. Thank You very much ;-). – AS_Python Apr 29 '14 at 16:55
  • I have found the exact reason of my problem - it was due to instalation of PIL (not pymorph). – AS_Python Apr 30 '14 at 15:39

0 Answers0