I'm trying to save a sci-kit image, but I'm getting the error:
ValueError: Image is not numeric, but ndarray.
Code:
from skimage import *
import skimage.io
import skimage.morphology as morphology
def loadImage(f):
return skimage.img_as_float(skimage.io.imread(f))
img = img_as_bool(loadImage("images/metric_map_processed.PNG"))
imgSk = morphology.medial_axis(img)
skimage.io.imsave("medial.png", imgSk)
According to the docs, the passed in array should be a ndarray, so why am I getting an error?
Just realised that my image was being converted to binary
Replacing
skimage.io.imsave("medial.png", imgSk)
with
skimage.io.imsave("medial.png", img_as_uint(imgSk))
worked for me