summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/ocr/LinksaveIn.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugins/ocr/LinksaveIn.py')
-rw-r--r--pyload/plugins/ocr/LinksaveIn.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/pyload/plugins/ocr/LinksaveIn.py b/pyload/plugins/ocr/LinksaveIn.py
index 10f7354d9..1bde857be 100644
--- a/pyload/plugins/ocr/LinksaveIn.py
+++ b/pyload/plugins/ocr/LinksaveIn.py
@@ -13,18 +13,20 @@ from pyload.plugins.base.OCR import OCR
class LinksaveIn(OCR):
- __name__ = "LinksaveIn"
- __type__ = "ocr"
+ __name__ = "LinksaveIn"
+ __type__ = "ocr"
__version__ = "0.1"
__description__ = """Linksave.in ocr plugin"""
- __authors__ = [("pyLoad Team", "admin@pyload.org")]
+ __license__ = "GPLv3"
+ __authors__ = [("pyLoad Team", "admin@pyload.org")]
def __init__(self):
OCR.__init__(self)
self.data_dir = dirname(abspath(__file__)) + sep + "LinksaveIn" + sep
+
def load_image(self, image):
im = Image.open(image)
frame_nr = 0
@@ -52,6 +54,7 @@ class LinksaveIn(OCR):
self.pixels = self.image.load()
self.result_captcha = ''
+
def get_bg(self):
stat = {}
cstat = {}
@@ -82,12 +85,13 @@ class LinksaveIn(OCR):
stat[bgpath] += 1
max_p = 0
bg = ""
- for bgpath, value in stat.items():
+ for bgpath, value in stat.iteritems():
if max_p < value:
bg = bgpath
max_p = value
return bg
+
def substract_bg(self, bgpath):
bg = Image.open(bgpath)
img = self.image.convert("P")
@@ -110,6 +114,7 @@ class LinksaveIn(OCR):
if rgb_c == rgb_bg:
orgpix[x, y] = (255,255,255)
+
def eval_black_white(self):
new = Image.new("RGB", (140, 75))
pix = new.load()
@@ -131,6 +136,7 @@ class LinksaveIn(OCR):
self.image = new
self.pixels = self.image.load()
+
def get_captcha(self, image):
self.load_image(image)
bg = self.get_bg()