From 76c302608bcad1c77a992666ee3867aa408c7e78 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 18 Dec 2015 06:05:51 +0100 Subject: [OCR] self.image -> self.img --- module/plugins/captcha/LinksaveIn.py | 24 ++++++++++++------------ module/plugins/captcha/ShareonlineBiz.py | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'module/plugins/captcha') 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 diff --git a/module/plugins/captcha/ShareonlineBiz.py b/module/plugins/captcha/ShareonlineBiz.py index 3e04bdcad..126d022ee 100644 --- a/module/plugins/captcha/ShareonlineBiz.py +++ b/module/plugins/captcha/ShareonlineBiz.py @@ -18,8 +18,8 @@ class ShareonlineBiz(OCR): def recognize(self, image): self.load_image(image) self.to_greyscale() - self.image = self.image.resize((160, 50)) - self.pixels = self.image.load() + self.img = self.img.resize((160, 50)) + self.pixels = self.img.load() self.threshold(1.85) # self.eval_black_white(240) # self.derotate_by_average() @@ -28,7 +28,7 @@ class ShareonlineBiz(OCR): final = "" for letter in letters: - self.image = letter + self.img = letter self.run_tesser(True, True, False, False) final += self.result_captcha -- cgit v1.2.3