diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-07-24 16:11:58 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-07-24 16:11:58 +0200 |
commit | 761ca5c66e07559925ebbdbc6531f9ca658b12ce (patch) | |
tree | bbdf0f330be882877a28366a852c90711c709338 /module/plugins/internal/OCR.py | |
parent | Hotfixes (2) (diff) | |
download | pyload-761ca5c66e07559925ebbdbc6531f9ca658b12ce.tar.xz |
Code cosmetics
Diffstat (limited to 'module/plugins/internal/OCR.py')
-rw-r--r-- | module/plugins/internal/OCR.py | 16 |
1 files changed, 8 insertions, 8 deletions
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 |