From 761ca5c66e07559925ebbdbc6531f9ca658b12ce Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 16:11:58 +0200 Subject: Code cosmetics --- module/plugins/internal/OCR.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/internal/OCR.py') diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py index 064bf1d7d..36d259e0c 100644 --- a/module/plugins/internal/OCR.py +++ b/module/plugins/internal/OCR.py @@ -88,7 +88,7 @@ class OCR(Plugin): self.pyload.log_debug("Saving tiff...") self.image.save(tmpTif.name, 'TIFF') - if os.name is "nt": + if os.name == "nt": tessparams = [os.path.join(pypath, "tesseract", "tesseract.exe")] else: tessparams = ["tesseract"] @@ -165,7 +165,7 @@ class OCR(Plugin): for x in xrange(w): for y in xrange(h): - if pixels[x, y] is 255: + if pixels[x, y] == 255: continue #: No point in processing white pixels since we only want to remove black pixel count = 0 @@ -198,7 +198,7 @@ class OCR(Plugin): #: 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] is 1: + if pixels[x, y] == 1: pixels[x, y] = 255 self.pixels = pixels @@ -213,7 +213,7 @@ class OCR(Plugin): for x in xrange(w): for y in xrange(h): - if pixels[x, y] is 0: + if pixels[x, y] == 0: pixels[x, y] = 155 highest = {} @@ -229,7 +229,7 @@ class OCR(Plugin): for x in xrange(w): for y in xrange(h): - if pixels[x, y] is 0: + if pixels[x, y] == 0: pixels[x, y] = 255 count = {} @@ -237,7 +237,7 @@ class OCR(Plugin): for x in xrange(w): count[x] = 0 for y in xrange(h): - if pixels[x, y] is 155: + if pixels[x, y] == 155: count[x] += 1 sum = 0 @@ -270,10 +270,10 @@ class OCR(Plugin): for x in xrange(w): for y in xrange(h): - if pixels[x, y] is 0: + if pixels[x, y] == 0: pixels[x, y] = 255 - if pixels[x, y] is 155: + if pixels[x, y] == 155: pixels[x, y] = 0 self.pixels = pixels -- cgit v1.2.3