Startup
This commit is contained in:
27
script/tutorial/18_Imaging.py
Normal file
27
script/tutorial/18_Imaging.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""
|
||||
Demonstrate creation of an image filter, applying it to a source and creating a new source
|
||||
based on the filter.
|
||||
"""
|
||||
|
||||
|
||||
import ch.psi.pshell.imaging.Filter as Filter
|
||||
from ch.psi.pshell.imaging.Utils import *
|
||||
|
||||
|
||||
class MyFilter(Filter):
|
||||
def process(self, image, data):
|
||||
image = grayscale(image)
|
||||
image = blur(image)
|
||||
image = sobel(image)
|
||||
return image
|
||||
|
||||
#Setting the filter to a source
|
||||
src1.setFilter(MyFilter())
|
||||
|
||||
#Creating a new source with the filter
|
||||
src2.setFilter(None)
|
||||
add_device(MyFilter("f1"), True)
|
||||
#f1.passive = True
|
||||
src2.addListener(f1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user