mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-11 05:52:22 +08:00
28 lines
947 B
Python
28 lines
947 B
Python
from skimage.filter import canny
|
|
|
|
from .overlayplugin import OverlayPlugin
|
|
|
|
|
|
class CannyPlugin(OverlayPlugin):
|
|
|
|
name = 'Canny Filter'
|
|
|
|
def __init__(self, image_viewer, *args, **kwargs):
|
|
height = kwargs.get('height', 100)
|
|
width = kwargs.get('width', 400)
|
|
super(CannyPlugin, self).__init__(image_viewer,
|
|
width=width, height=height)
|
|
self.add_keyword_argument('sigma', 0, 5, update_on='release')
|
|
self.add_keyword_argument('low_threshold', 0, 255, update_on='release')
|
|
self.add_keyword_argument('high_threshold', 0, 255, update_on='release')
|
|
# Call callback so that image is updated to slider values.
|
|
self.caller()
|
|
|
|
def callback(self, *args, **kwargs):
|
|
image = canny(*args, **kwargs)
|
|
self.overlay = image
|
|
|
|
def closeEvent(self, event):
|
|
self.overlay = None
|
|
super(CannyPlugin, self).closeEvent(event)
|