I am trying to convert an uploaded image(JPEG, gif) into uint8/16 type on Google Colab using skimage.util.
# How to Import an image
from google.colab import files
from IPython.display import Image
# Convert to 8-bit uint
from skimage.util import img_as_uint
uploaded = files.upload()
img_as_uint(uploaded)
I am getting error in last line as:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-12-c19636843da4> in <module>()
----> 1 img_as_uint(uploaded)
1 frames
/usr/local/lib/python3.6/dist-packages/skimage/util/dtype.py in convert(image, dtype, force_copy, uniform)
248 if not (dtype_in in _supported_types and dtype_out in _supported_types):
249 raise ValueError("Can not convert from {} to {}."
--> 250 .format(dtypeobj_in, dtypeobj_out))
251
252 if kind_in in 'ui':
ValueError: Can not convert from object to uint16.