コード例 #1
0
ファイル: Clean.py プロジェクト: BackupTheBerlios/eikazo
 def filter(self, job):
     img = job.img
     
     mode = img.mode
     if mode != '1':
         return
     
     len = self.averageSize * job.resolution / 25.4
     len = int(len) | 1
     
     thrsh = int(len*len * self.threshold / 100)
     
     job.img = MeanFilter.fixedThresholdFilter(img, len, thrsh)
コード例 #2
0
ファイル: Threshold.py プロジェクト: BackupTheBerlios/eikazo
 def filter(self, job):
     img = job.img
     
     mode = img.mode
     if mode == '1':
         return
     elif mode == 'RGB':
         img = img.convert('L')
     elif mode != 'L':
         raise SaneError('unexpected image mode: %s' % mode)
     
     len = self.averageSize * job.resolution / 25.4
     # we need an odd number of pixels as the square length
     len = int(len) | 1
     
     offs = self.averageOffset * 255.0 / 100.0
     offs = int(round(offs))
     
     img = MeanFilter.adaptiveThresholdFilter(img, len, -offs)
     job.img = img.convert('1')