Mercurial > ift6266
comparison data_generation/transformations/gimp_script.py @ 254:dd2df78fcf47
added option to pipeline and gimp_script to produce NIST-friendly data
author | Xavier Glorot <glorotxa@iro.umontreal.ca> |
---|---|
date | Wed, 17 Mar 2010 13:57:15 -0400 |
parents | 39421555993f |
children | d5b2b6397a5a |
comparison
equal
deleted
inserted
replaced
246:2024368a8d3d | 254:dd2df78fcf47 |
---|---|
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 |