Search code examples
pythonpython-3.ximage-processingscikit-image

How to save output image from Scikit image viewer?


I want to store the output of an image processed using Scikit image viewer. Below is my code:

import skimage
image1 = skimage.io.imread(fname='shot1.tif', as_gray=True)
viewer = skimage.viewer.ImageViewer(image1)

edges = skimage.feature.canny(
        image=image1,
        sigma=2.0,
        low_threshold=0.1,
        high_threshold=0.2
        )

viewer = skimage.viewer.ImageViewer(edges)
viewer.show()

What is the code to store the output from 'viewer.show()' in a file?


Solution

  • The answer should be this one

    skimage.io.imsave(fname, edges)
    

    you can find more about the parameters you can use here:

    https://scikit-image.org/docs/dev/api/skimage.io.html#imsave