summaryrefslogtreecommitdiffstats
path: root/module/plugins/captcha/LinksaveIn.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-12-18 06:05:51 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-12-27 22:37:05 +0100
commit76c302608bcad1c77a992666ee3867aa408c7e78 (patch)
treeb1278cbac68cacdf136d8dd4e0182451e2c469db /module/plugins/captcha/LinksaveIn.py
parentDon't use PERIODICAL_INTERVAL (diff)
downloadpyload-76c302608bcad1c77a992666ee3867aa408c7e78.tar.xz
[OCR] self.image -> self.img
Diffstat (limited to 'module/plugins/captcha/LinksaveIn.py')
-rw-r--r--module/plugins/captcha/LinksaveIn.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py
index 27d1898bb..34e32a208 100644
--- a/module/plugins/captcha/LinksaveIn.py
+++ b/module/plugins/captcha/LinksaveIn.py
@@ -50,15 +50,15 @@ class LinksaveIn(OCR):
npix[x, y] = lut[pix[x, y]]
frame_nr += 1
new.save(self.data_dir+"unblacked.png")
- self.image = new.copy()
- self.pixels = self.image.load()
+ self.img = new.copy()
+ self.pixels = self.img.load()
self.result_captcha = ""
def get_bg(self):
stat = {}
cstat = {}
- img = self.image.convert("P")
+ img = self.img.convert("P")
for bgpath in glob.glob(self.data_dir+"bg/*.gif"):
stat[bgpath] = 0
bg = Image.open(bgpath)
@@ -96,7 +96,7 @@ class LinksaveIn(OCR):
def substract_bg(self, bgpath):
bg = Image.open(bgpath)
- img = self.image.convert("P")
+ img = self.img.convert("P")
bglut = bg.resize((256, 1))
bglut.putdata(xrange(256))
@@ -108,7 +108,7 @@ class LinksaveIn(OCR):
bgpix = bg.load()
pix = img.load()
- orgpix = self.image.load()
+ orgpix = self.img.load()
for x in xrange(bg.size[0]):
for y in xrange(bg.size[1]):
rgb_bg = bglut[bgpix[x, y]]
@@ -120,7 +120,7 @@ class LinksaveIn(OCR):
def eval_black_white(self):
new = Image.new("RGB", (140, 75))
pix = new.load()
- orgpix = self.image.load()
+ orgpix = self.img.load()
thresh = 4
for x in xrange(new.size[0]):
for y in xrange(new.size[1]):
@@ -135,8 +135,8 @@ class LinksaveIn(OCR):
pix[x, y] = (0, 0, 0)
if b > max(r, g)+thresh:
pix[x, y] = (0, 0, 0)
- self.image = new
- self.pixels = self.image.load()
+ self.img = new
+ self.pixels = self.img.load()
def recognize(self, image):
@@ -145,15 +145,15 @@ class LinksaveIn(OCR):
self.substract_bg(bg)
self.eval_black_white()
self.to_greyscale()
- self.image.save(self.data_dir+"cleaned_pass1.png")
+ self.img.save(self.data_dir+"cleaned_pass1.png")
self.clean(4)
self.clean(4)
- self.image.save(self.data_dir+"cleaned_pass2.png")
+ self.img.save(self.data_dir+"cleaned_pass2.png")
letters = self.split_captcha_letters()
final = ""
for n, letter in enumerate(letters):
- self.image = letter
- self.image.save(ocr.data_dir+"letter%d.png" % n)
+ self.img = letter
+ self.img.save(ocr.data_dir+"letter%d.png" % n)
self.run_tesser(True, True, False, False)
final += self.result_captcha