summaryrefslogtreecommitdiffstats
path: root/module/captcha/LinksaveIn.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-12-09 22:44:30 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-12-09 22:44:30 +0100
commit93efe4b3ab66ef1deca2a7a8dfe04bcf3b3a7875 (patch)
treee7e8f384c285000a2b2bb21e70eef956cd4d16ba /module/captcha/LinksaveIn.py
parentDLC fixed (diff)
downloadpyload-93efe4b3ab66ef1deca2a7a8dfe04bcf3b3a7875.tar.xz
incomplete: gui model-view stuff
Diffstat (limited to 'module/captcha/LinksaveIn.py')
-rw-r--r--module/captcha/LinksaveIn.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/module/captcha/LinksaveIn.py b/module/captcha/LinksaveIn.py
index 4219f03b5..15ccdb1ac 100644
--- a/module/captcha/LinksaveIn.py
+++ b/module/captcha/LinksaveIn.py
@@ -140,18 +140,24 @@ class LinksaveIn(OCR):
self.eval_black_white()
self.to_greyscale()
self.image.save(self.data_dir+"cleaned_pass1.png")
- self.clean(6)
+ self.clean(4)
+ self.clean(4)
self.image.save(self.data_dir+"cleaned_pass2.png")
letters = self.split_captcha_letters()
+ org = self.image
+ final = ""
+ for n, letter in enumerate(letters):
+ self.image = letter
+ self.image.save(ocr.data_dir+"letter%d.png" % n)
+ self.run_tesser()
+ final += self.result_captcha
- self.run_tesser()
-
- return self.result_captcha
+ return final
if __name__ == '__main__':
import urllib
ocr = LinksaveIn()
testurl = "http://linksave.in/captcha/cap.php?hsh=2229185&code=ZzHdhl3UffV3lXTH5U4b7nShXj%2Bwma1vyoNBcbc6lcc%3D"
- urllib.urlretrieve(testurl, "captcha.gif")
+ urllib.urlretrieve(testurl, ocr.data_dir+"captcha.gif")
- print ocr.get_captcha('captcha.gif')
+ print ocr.get_captcha(ocr.data_dir+'captcha.gif')