comparison transformations/testtransformations.py @ 94:1b8176e9892e

cleaning some *.pyc and *.py~ files in pycapcha
author Xavier Glorot <glorotxa@iro.umontreal.ca>
date Thu, 11 Feb 2010 11:55:03 -0500
parents 104e0b8a1c70
children b3d15100842a
comparison
equal deleted inserted replaced
93:7054d7afb948 94:1b8176e9892e
26 26
27 ###---------------------order of transformation module 27 ###---------------------order of transformation module
28 MODULE_INSTANCES = [Slant(),Thick(),AffineTransformation(),LocalElasticDistorter(),GIMP1(), PermutPixel(),DistorsionGauss(), Rature(), Occlusion(),AddBackground(), BruitGauss(),PoivreSel(), Contrast()] 28 MODULE_INSTANCES = [Slant(),Thick(),AffineTransformation(),LocalElasticDistorter(),GIMP1(), PermutPixel(),DistorsionGauss(), Rature(), Occlusion(),AddBackground(), BruitGauss(),PoivreSel(), Contrast()]
29 29
30 ###---------------------complexity associated to each of them 30 ###---------------------complexity associated to each of them
31 complexity = [0.7,0.7,0.7,0.7,0.7,0.3,0.3,0.5,0.5,0.1,0.3,0.3,0.5] 31 complexity = [0.6,0.6,0.6,0.6,0.6,0.3,0.3,0.5,0.5,0.5,0.3,0.3,0.5]
32 complexity = [0.5]*len(MODULE_INSTANCES)
32 #complexity = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.] 33 #complexity = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.]
33 34
34 35
35 36
36 nbmodule = len(MODULE_INSTANCES) 37 nbmodule = len(MODULE_INSTANCES)
50 #pygame.Surface.set_palette(anglcolorpalette) 51 #pygame.Surface.set_palette(anglcolorpalette)
51 #screen.set_palette(anglcolorpalette) 52 #screen.set_palette(anglcolorpalette)
52 53
53 pygame.font.init() 54 pygame.font.init()
54 55
55 for i in range(10000): 56 for i in range(1000):
56 a=d[i,:] 57 a=d[i,:]
57 b=N.asarray(N.reshape(a,(32,32))) 58 b=N.asarray(N.reshape(a,(32,32)))
58 c=N.asarray([N.reshape(a*255.0,(32,32))]*3).T 59 c=N.asarray([N.reshape(a*255.0,(32,32))]*3).T
59 new=pygame.surfarray.make_surface(c) 60 new=pygame.surfarray.make_surface(c)
60 new=pygame.transform.scale2x(new) 61 new=pygame.transform.scale2x(new)
86 offset = 0 87 offset = 0
87 offset2 = 4*32+20 88 offset2 = 4*32+20
88 else: 89 else:
89 offset += 4*32 90 offset += 4*32
90 ct+=1 91 ct+=1
91 pygame.image.save(screen,'/u/glorotxa/exemples/%s.BMP'%i) 92 pygame.image.save(screen,'/u/glorotxa/exemples/%s.PNG'%i)
92 #raw_input('Press Enter') 93 #raw_input('Press Enter')
93 94
94 #pygame.display.quit() 95 #pygame.display.quit()