From dad722ac7255640e7e0541c4094a4d2e4de79cd3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 00:05:58 +0200 Subject: Code cosmetics (2) --- module/plugins/internal/OCR.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/internal/OCR.py') diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py index 880f8b570..9ddca0315 100644 --- a/module/plugins/internal/OCR.py +++ b/module/plugins/internal/OCR.py @@ -61,12 +61,12 @@ class OCR(Plugin): def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True, pagesegmode=None): - #: tmpTif = tempfile.NamedTemporaryFile(suffix=".tif") + # tmpTif = tempfile.NamedTemporaryFile(suffix=".tif") try: tmpTif = open(fs_join("tmp", "tmpTif_%s.tif" % self.__name__), "wb") tmpTif.close() - #: tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") + # tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") tmpTxt = open(fs_join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb") tmpTxt.close() @@ -88,7 +88,7 @@ class OCR(Plugin): tessparams.extend(["-psm", str(pagesegmode)]) if subset and (digits or lowercase or uppercase): - #: tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") + # tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") with open(fs_join("tmp", "tmpSub_%s.subset" % self.__name__), "wb") as tmpSub: tmpSub.write("tessedit_char_whitelist ") @@ -177,12 +177,12 @@ class OCR(Plugin): except Exception: pass - #: not enough neighbors are dark pixels so mark this pixel - #: to be changed to white + #: Not enough neighbors are dark pixels so mark this pixel + #: To be changed to white if count < allowed: pixels[x, y] = 1 - #: second pass: this time set all 1's to 255 (white) + #: Second pass: this time set all 1's to 255 (white) for x in xrange(w): for y in xrange(h): if pixels[x, y] == 1: -- cgit v1.2.3