image-processing
image-processing copied to clipboard
Fix call to img_as_ubyte
The function img_as_ubyte
needs to be called as skimage.util.img_as_ubyte
. The util
part was sometimes missing.
No, it's not necessary: I just checked and I could equally from skimage import img_as_ubyte
and from skimage.util import img_as_ubyte
. I guess the magic is happening here:
https://github.com/scikit-image/scikit-image/blob/533a5b5c0852b38890d63c348117aba8055b3995/skimage/init.py#L152-L158
Nice, I did not know that. I still think it is better to call it consistently (either with or without util
). I think it fits slightly better to use the util
submodule as most other functions are called from submodules as well. But I'm happy to discuss the pro and cons.
Your comment also made me realize, that in the "Resizing an image" box, we need to also import skimage.util
or import skimage
. Otherwise, neither of the ways to call img_as_ubyte
will work.
You are right that, for educational purposes, it's probably better to keep the util
submodule explicit.
Thank you @iimog 🙌