|
31 | 31 | #sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
32 | 32 |
|
33 | 33 | TOOL = 'ocrd-cis-ocropy-binarize'
|
34 |
| -LOG = getLogger('processor.OcropyBinarize') |
35 | 34 |
|
36 | 35 | def binarize(pil_image, method='ocropy', maxskew=2, threshold=0.5, nrm=False, zoom=1.0):
|
| 36 | + LOG = getLogger('processor.OcropyBinarize') |
37 | 37 | LOG.debug('binarizing %dx%d image with method=%s', pil_image.width, pil_image.height, method)
|
38 | 38 | if method == 'none':
|
39 | 39 | # useful if the images are already binary,
|
@@ -76,6 +76,7 @@ def __init__(self, *args, **kwargs):
|
76 | 76 | kwargs['ocrd_tool'] = self.ocrd_tool['tools'][TOOL]
|
77 | 77 | kwargs['version'] = self.ocrd_tool['version']
|
78 | 78 | super(OcropyBinarize, self).__init__(*args, **kwargs)
|
| 79 | + LOG = getLogger('processor.OcropyBinarize') |
79 | 80 | if hasattr(self, 'output_file_grp'):
|
80 | 81 | if self.parameter['grayscale'] and self.parameter['method'] != 'ocropy':
|
81 | 82 | LOG.critical('requested method %s does not support grayscale normalized output',
|
@@ -104,6 +105,7 @@ def process(self):
|
104 | 105 |
|
105 | 106 | Produce a new output file by serialising the resulting hierarchy.
|
106 | 107 | """
|
| 108 | + LOG = getLogger('processor.OcropyBinarize') |
107 | 109 | level = self.parameter['level-of-operation']
|
108 | 110 | assert_file_grp_cardinality(self.input_file_grp, 1)
|
109 | 111 | assert_file_grp_cardinality(self.output_file_grp, 1)
|
@@ -181,6 +183,7 @@ def process(self):
|
181 | 183 | file_id, self.output_file_grp, out.local_filename)
|
182 | 184 |
|
183 | 185 | def process_page(self, page, page_image, page_xywh, zoom, page_id, file_id):
|
| 186 | + LOG = getLogger('processor.OcropyBinarize') |
184 | 187 | LOG.info("About to binarize page '%s'", page_id)
|
185 | 188 | features = page_xywh['features']
|
186 | 189 | if 'angle' in page_xywh and page_xywh['angle']:
|
@@ -226,6 +229,7 @@ def process_page(self, page, page_image, page_xywh, zoom, page_id, file_id):
|
226 | 229 | comments=features))
|
227 | 230 |
|
228 | 231 | def process_region(self, region, region_image, region_xywh, zoom, page_id, file_id):
|
| 232 | + LOG = getLogger('processor.OcropyBinarize') |
229 | 233 | LOG.info("About to binarize page '%s' region '%s'", page_id, region.id)
|
230 | 234 | features = region_xywh['features']
|
231 | 235 | if 'angle' in region_xywh and region_xywh['angle']:
|
@@ -273,6 +277,7 @@ def process_region(self, region, region_image, region_xywh, zoom, page_id, file_
|
273 | 277 | comments=features))
|
274 | 278 |
|
275 | 279 | def process_line(self, line, line_image, line_xywh, zoom, page_id, region_id, file_id):
|
| 280 | + LOG = getLogger('processor.OcropyBinarize') |
276 | 281 | LOG.info("About to binarize page '%s' region '%s' line '%s'",
|
277 | 282 | page_id, region_id, line.id)
|
278 | 283 | features = line_xywh['features']
|
|
0 commit comments