I want to turn off skimage UserWarning: I used this code but they are still enabled.
with warnings.catch_warnings():
warnings.simplefilter("ignore")
skimage.io.imsave
I found in the documentation that there is a dedicated option "check_contrast" when imsave is called: https://scikit-image.org/docs/dev/api/skimage.io.html?#imsave
If you want to disable imsave warnings indicating a low contrast image you should set this option to False: check_contrast=False
from skimage import io
io.imsave(filename, image, check_contrast=False)
Apparently skimage uses imageio as his first plugin option to save an image.
Try to:
import imageio.core.util
def ignore_warnings(*args, **kwargs):
pass
imageio.core.util._precision_warn = ignore_warnings
After that, you can save your image without the warnings:
imsave(filename, image)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With