Ok, that gives me more information. I coded it in the way that I understood your intention on the commented out code.
Result:
Try this:
#@gui An Experiment in Terror : pr_ter, pr_ter_preview
#@gui : 1.Iterations = int(1,1,100)
#@gui : 2.Filter 1 = choice(0,"Blur","Bilateral","Boxfilter","Dilate","Erode","Smooth","Sharpen")
#@gui : 3.Value = float(0,0,10000)
#@gui : 4.Filter 2 = choice(0,"Blur","Bilateral","Boxfilter","Dilate","Erode","Smooth","Sharpen")
#@gui : 5.Value = float(0,0,10000)
#@gui : 6.Filter 3 = choice(0,"Blur","Bilateral","Boxfilter","Dilate","Erode","Smooth","Sharpen")
#@gui : 7.Value = float(0,0,10000)
#@gui : 8.Filter 4 = choice(0,"Blur","Bilateral","Boxfilter","Dilate","Erode","Smooth","Sharpen")
#@gui : 9.Value = float(0,0,10000)
#@gui : 10.Filter 5 = choice(0,"Blur","Bilateral","Boxfilter","Dilate","Erode","Smooth","Sharpen")
#@gui : 11.Value = float(0,0,10000)
#@gui : 12.Filter 6 = choice(0,"Blur","Bilateral","Boxfilter","Dilate","Erode","Smooth","Sharpen")
#@gui : 13.Value = float(0,0,10000)
#@gui : 14.Hue = float(0,-100,100)
#@gui : 15.Saturation = float(0,-100,100)
#@gui : 16.Saturation (post) = float(0,-100,100)
pr_ter :
m "foo_bilateral: bilateral $""1,$""1,$""1,$""1"
foreach {
+_pr_ter_process_per_image ${1--4},$-2
blend and,.5
if $-3||$-1 adjust_colors 0,0,0,$-3,$-1 fi
}
um foo_bilateral
_pr_ter_process_per_image :
$=arg
repeat $1 {
repeat ($#-2)/2 {
value=${arg{$>*2+3}}
filter_choice=${arg{$>*2+2}}
if $value
arg0 $filter_choice,blur\ $value,foo_bilateral\ $value,boxfilter\ $value,dilate\ $value,erode\ $value,smooth\ $value,sharpen\ $value
run ${}
fi
}
if $-1 adjust_colors 0,0,0,0,$-1 fi
}
pr_ter_preview :
pr_ter $*
The reason I’m using negative argument selection is to allow for dynamic amount of Filter/Value combos. In my opinion, you don’t need 6. 3-4 will do. Also, it’s hard to work with big values, I had to type in values.
Edit: You can probably make it easier to use by using something like int(1*10^x)
and further adjustment with math and gui elements. This is logarithmic scaling. Hint on math part, 1*10^(x<0)
is less than 1. Probably overkill.
Here it is with logarithmic scaling. Now, it’s easier to use as it feels more natural:
0 - 1
1 - 10
2 - 100
3 - 1000
4 - 10000
#@gui An Experiment in Terror : pr_ter, pr_ter_preview
#@gui : 1.Iterations = int(1,1,100)
#@gui : 2.Filter 1 = choice(0,"Blur","Bilateral","Boxfilter","Dilate","Erode","Smooth","Sharpen")
#@gui : 3.Value = float(-.001,-.001,4)
#@gui : 4.Filter 2 = choice(0,"Blur","Bilateral","Boxfilter","Dilate","Erode","Smooth","Sharpen")
#@gui : 5.Value = float(-.001,-.001,4)
#@gui : 6.Filter 3 = choice(0,"Blur","Bilateral","Boxfilter","Dilate","Erode","Smooth","Sharpen")
#@gui : 7.Value = float(-.001,-.001,4)
#@gui : 8.Filter 4 = choice(0,"Blur","Bilateral","Boxfilter","Dilate","Erode","Smooth","Sharpen")
#@gui : 9.Value = float(-.001,-.001,4)
#@gui : 10.Filter 5 = choice(0,"Blur","Bilateral","Boxfilter","Dilate","Erode","Smooth","Sharpen")
#@gui : 11.Value = float(-.001,-.001,4)
#@gui : 12.Filter 6 = choice(0,"Blur","Bilateral","Boxfilter","Dilate","Erode","Smooth","Sharpen")
#@gui : 13.Value = float(-.001,-.001,4)
#@gui : 14.Hue = float(0,-100,100)
#@gui : 15.Saturation = float(0,-100,100)
#@gui : 16.Saturation (post) = float(0,-100,100)
pr_ter :
m "foo_bilateral: bilateral $""1,$""1,$""1,$""1"
foreach {
+_pr_ter_process_per_image ${1--4},$-2
blend and,.5
if $-3||$-1 adjust_colors 0,0,0,$-3,$-1 fi
}
um foo_bilateral
_pr_ter_process_per_image :
$=arg
N:=($#-2)/2 # Number of Filter/Value combo
repeat $1 {
repeat $N {
value:=int(10^${arg{$>*2+3}})
filter_choice=${arg{$>*2+2}}
if $value
arg0 $filter_choice,blur\ $value,foo_bilateral\ $value,boxfilter\ $value,dilate\ $value,erode\ $value,smooth\ $value,sharpen\ $value
run ${}
fi
}
if $-1 adjust_colors 0,0,0,0,$-1 fi
}
pr_ter_preview :
pr_ter $*