comparison data_generation/transformations/gimp_script.py @ 260:0c0f0b3f6a93

branch merge.
author Arnaud Bergeron <abergeron@gmail.com>
date Wed, 17 Mar 2010 15:31:21 -0400
parents dd2df78fcf47
children d5b2b6397a5a
comparison
equal deleted inserted replaced
259:3919c71e3091 260:0c0f0b3f6a93
36 36
37 def get_settings_names(self, blur_bool = True): 37 def get_settings_names(self, blur_bool = True):
38 return ['mblur_length', 'mblur_angle', 'pinch'] 38 return ['mblur_length', 'mblur_angle', 'pinch']
39 39
40 def regenerate_parameters(self, complexity): 40 def regenerate_parameters(self, complexity):
41 if complexity and self.blur_bool: 41 if complexity:
42 self.mblur_length = abs(int(round(numpy.random.normal(0, 3*complexity)))) 42 self.mblur_length = abs(int(round(numpy.random.normal(0, 3*complexity))))
43 else: 43 else:
44 self.mblur_length = 0 44 self.mblur_length = 0
45 self.mblur_angle = int(round(numpy.random.uniform(0,360))) 45 self.mblur_angle = int(round(numpy.random.uniform(0,360)))
46 self.pinch = numpy.random.uniform(-complexity, 0.7*complexity) 46 self.pinch = numpy.random.uniform(-complexity, 0.7*complexity)
48 return [self.mblur_length, self.mblur_angle, self.pinch] 48 return [self.mblur_length, self.mblur_angle, self.pinch]
49 49
50 def transform_image(self, image): 50 def transform_image(self, image):
51 if self.mblur_length or self.pinch: 51 if self.mblur_length or self.pinch:
52 setpix(image) 52 setpix(image)
53 if self.mblur_length: 53 if self.mblur_length and self.blur_bool:
54 pdb.plug_in_mblur(img, layer1, 0, self.mblur_length, self.mblur_angle, 0, 0) 54 pdb.plug_in_mblur(img, layer1, 0, self.mblur_length, self.mblur_angle, 0, 0)
55 if self.pinch: 55 if self.pinch:
56 pdb.plug_in_whirl_pinch(img, layer1, 0.0, self.pinch, 1.0) 56 pdb.plug_in_whirl_pinch(img, layer1, 0.0, self.pinch, 1.0)
57 image = getpix() 57 image = getpix()
58 58