-
-
Save anonymous/d80325f8c8d93a2c9adcf979b9101149 to your computer and use it in GitHub Desktop.
Simpleware Scripting Webinar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scanip_api import * | |
import csv | |
import itertools | |
import os.path | |
app = App.GetInstance() | |
doc = App.GetDocument() | |
class ThinObjectSmoother(Command): | |
def __init__(self, dilate, smooth, erode): | |
Command.__init__(self) | |
self.dilate = dilate | |
self.smooth = smooth | |
self.erode = erode | |
def GetName(self): | |
return "Special Smooth" | |
def OnNativeDelete(self): | |
doc.ReleaseCommand(self) | |
def Do(self): | |
doc.ApplyDilateFilter(Doc.TargetMask, self.dilate, 0) | |
doc.ApplyRecursiveGaussianFilter(Doc.TargetMask, True, Sigma(self.smooth)) | |
doc.ApplyErodeFilter(Doc.TargetMask, self.erode, 0) | |
return True | |
# Just run once... | |
doc.SubmitCommand(ThinObjectSmoother(4, 4.5, 3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment