License: OTHER
from skimage import data1from skimage.feature import canny2from skimage.viewer import ImageViewer3from skimage.viewer.plugins.overlayplugin import OverlayPlugin4from skimage.viewer.widgets import Slider567class CannyPlugin(OverlayPlugin):89def __init__(self, *args, **kwargs):10super(CannyPlugin, self).__init__(image_filter=canny, **kwargs)1112def attach(self, image_viewer):13# add widgets14self.add_widget(Slider('sigma', 0, 5))15self.add_widget(Slider('low threshold', 0, 255, value_type='int'))16self.add_widget(Slider('high threshold', 0, 255, value_type='int'))1718super(CannyPlugin, self).attach(image_viewer)192021image = data.camera()22viewer = ImageViewer(image)23viewer += CannyPlugin()24viewer.show()252627