@@ -33,31 +33,28 @@ def draw
3333 when 1
3434 # automatic
3535 # @processed_image = Threshold.apply(my_image)
36-
3736 # by mouseX
3837 @processed_image = Threshold . apply ( my_image , map1d ( mouse_x , 0 ..width , 0 ..255 ) )
39-
40- # Dilation expands the white regions by a radius
41- # works best with threshold/binary images
4238 when 2 , 3 , 10
4339 quant = map1d ( mouse_x , 0 ..width , 1 ..10 )
44- return @processed_image = Quantization . apply (
45- my_image , quant
46- ) if current_algorithm == 10
47- @processed_image = Threshold . apply ( my_image )
48- if current_algorithm == 2
49- @processed_image = Dilation . apply ( processed_image , quant )
40+ if current_algorithm == 10
41+ @processed_image = Quantization . apply ( my_image , quant )
5042 else
51- # Erosion expands the dark regions by a radius
52- # works best with threshold/binary images
53- @processed_image = Erosion . apply ( processed_image , quant )
43+ @processed_image = Threshold . apply ( my_image )
44+ if current_algorithm == 2
45+ # Dilation expands the white regions by a radius
46+ # works best with threshold/binary images
47+ @processed_image = Dilation . apply ( processed_image , quant )
48+ else
49+ # Erosion expands the dark regions by a radius
50+ # works best with threshold/binary images
51+ @processed_image = Erosion . apply ( processed_image , quant )
52+ end
5453 end
55-
5654 # Brightness correction
5755 when 4
5856 intensity = map1d ( mouse_x , 0 ..width , -255 ..255 )
5957 @processed_image = Brightness . apply ( my_image , intensity )
60-
6158 # AutoBalance for simple color correction
6259 when 5
6360 @processed_image = AutoBalance . apply ( my_image )
0 commit comments