im trying load image file ndarray this:
image_data = ndimage.imread(image_file).astype(float)
but error:
/home/milos/anaconda3/envs/tensorflow/lib/python3.5/site-packages/scipy/ndimage/io.py in imread(fname, flatten, mode) 23 if _have_pil: 24 return _imread(fname, flatten, mode) ---> 25 raise importerror("could not import python imaging library (pil)" 26 " required load image files. please refer to" 27 " http://pypi.python.org/pypi/pil/ installation" importerror: not import python imaging library (pil) required load image files. please refer http://pypi.python.org/pypi/pil/ installation instructions.
i have pillow installed inside environment im running notebook, shows on pip freeze. tried running console got similar error.
any ideas how fix this? or there alternative way load image ndarray?
managed in end bypassing scipy :
from pil import image img = image.open(image_file) image_data = np.array(img).astype(float)
would still know problem scipy, please post if know it
edit :
found better solution:
import matplotlib.pyplot plt import matplotlib.image mpimg image_data = mpimg.imread(image_file)
this creates numpy ndarray , normalizes pixel depths 0-1, , worked nicely if wanted backwards conversion check if still good:
plt.imshow(image_data)
Comments
Post a Comment