summaryrefslogtreecommitdiffstats
path: root/captcha/captcha.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-17 23:18:27 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-17 23:18:27 +0200
commitc5234a8b3d223f9860de161894ae8a4623e1ae05 (patch)
treed98aa17e3c0e738940e8957b390cd32e4b0955ee /captcha/captcha.py
parentadded a error message if gui cant connect to server (diff)
downloadpyload-c5234a8b3d223f9860de161894ae8a4623e1ae05.tar.xz
plugins can import captcha method, see #6
Diffstat (limited to 'captcha/captcha.py')
-rw-r--r--captcha/captcha.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/captcha/captcha.py b/captcha/captcha.py
index 361893fa3..de3e61cf0 100644
--- a/captcha/captcha.py
+++ b/captcha/captcha.py
@@ -2,13 +2,19 @@ import Image
import ImageOps
import subprocess
-class Ocr(object):
- def __init__(self, image):
+class OCR(object):
+ def __init__(self):
+ pass
+
+ def load_image(self, image):
self.image = Image.open(image)
self.pixels = self.image.load()
self.image_name = 'captcha_clean.png'
self.result_captcha = ''
+ def unload():
+ """delete all tmp images"""
+ pass
def threshold(self, value):
self.image = self.image.point(lambda a: a * value +10)
@@ -27,7 +33,7 @@ class Ocr(object):
self.result_captcha = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].replace('\n','')
def get_captcha(self):
- pass
+ raise NotImplementedError
def to_greyscale(self):
if self.image.mode != 'L':
@@ -74,5 +80,5 @@ class Ocr(object):
if __name__ == '__main__':
- ocr = Ocr('gigasize-com/7.jpg')
+ ocr = OCR('gigasize-com/7.jpg')
print ocr.get_captcha()