changeset 130:38929c29b602

merge
author Xavier Glorot <glorotxa@iro.umontreal.ca>
date Thu, 18 Feb 2010 14:44:23 -0500
parents a507adba0ce3 (current diff) ccce06590e64 (diff)
children 5c79a2557f2f
files
diffstat 3 files changed, 59 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/pycaptcha/Captcha/data/words/characters	Thu Feb 18 14:43:53 2010 -0500
+++ b/pycaptcha/Captcha/data/words/characters	Thu Feb 18 14:44:23 2010 -0500
@@ -1,26 +1,62 @@
-q
-w
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+A
+B
+C
+D
+E
+F
+G
+H
+I
+J
+K
+L
+M
+N
+O
+P
+Q
+R
+S
+T
+U
+V
+W
+X
+Y
+Z
+a
+b
+c
+d
 e
-r
-t
-y
-u
-i
-o
-p
-a
-s
-d
 f
 g
 h
+i
 j
 k
 l
-z
-x
-c
+m
+n
+o
+p
+q
+r
+s
+t
+u
 v
-b
-n
-m
+w
+x
+y
+z
--- a/pycaptcha/Facade.py	Thu Feb 18 14:43:53 2010 -0500
+++ b/pycaptcha/Facade.py	Thu Feb 18 14:44:23 2010 -0500
@@ -30,4 +30,4 @@
        return a
 
     else :
-        return (a, g,solutions)
+        return (a, g.solutions)
--- a/transformations/pipeline.py	Thu Feb 18 14:43:53 2010 -0500
+++ b/transformations/pipeline.py	Thu Feb 18 14:44:23 2010 -0500
@@ -55,6 +55,7 @@
 from add_background_image import AddBackground
 from affine_transform import AffineTransformation
 from ttf2jpg import ttf2jpg
+from ..pycaptcha.Facade import generateCaptcha
 
 if DEBUG:
     from visualizer import Visualizer
@@ -219,13 +220,15 @@
         ocr_img = ft.read(nist.ocr_data)
         ocr_labels = ft.read(nist.ocr_labels)
     ttf = ttf2jpg()
+    L = [chr(ord('0')+x) for x in range(10)] + [chr(ord('A')+x) for x in range(26)] + [chr(ord('a')+x) for x in range(26)]
 
     for i in xrange(num_img):
         r = numpy.random.rand()
         if r <= prob_font:
             yield ttf.generate_image()
         elif r <= prob_font + prob_captcha:
-            pass #get captcha
+            (arr, charac) = generateCaptcha(0,1)
+            yield arr.astype(numpy.float32)/255, L.index(charac)
         elif r <= prob_font + prob_captcha + prob_ocr:
             j = numpy.random.randint(len(ocr_labels))
             yield ocr_img[j].astype(numpy.float32)/255, ocr_labels[j]