No manual entry since it doesn’t have CLI comments. The code is available here: https://raw.githubusercontent.com/dtschump/gmic/master/src/gmic_stdlib.gmic. Hint: $1
, $2
, etc., are the parameters in order.
#@gui Smooth [Skin] : fx_smooth_skin, fx_smooth_skin_preview(1)
#@gui : note = note("<small><b>Step 1:</b> Skin detection</small>")
#@gui : Skin Estimation = choice(2,"None","Manual","Automatic")
#@gui : Tolerance = float(0.5,0,1)
#@gui : Smoothness = float(1,0,5)
#@gui : Threshold = float(1,0,10)
#@gui : Pre-Normalize Image = bool(1)
#@gui : X-Coordinate [Manual] = float(50,0,100)
#@gui : Y-Coordinate [Manual] = float(50,0,100)
#@gui : Radius [Manual] = float(5,0,25)
#@gui : sep = separator()
#@gui : note = note("<small><b>Step 2:</b> Medium scale smoothing</small>")
#@gui : Base Scale = float(2,0,10)
#@gui : Fine Scale = float(0.2,0,0.8)
#@gui : Smoothness = float(3,0,10)
#@gui : Smoothness Type = choice(1,"Gaussian","Bilateral")
#@gui : sep = separator()
#@gui : note = note("<small><b>Step 3:</b> Details enhancement</small>")
#@gui : Gain = float(0.05,0,0.5)
#@gui : sep = separator()
#@gui : Preview Data = choice{5,"Skin Mask","Base Scale","Medium Scale (Original)","Medium Scale (Smoothed)",
#@gui : "Fine Scale","Result Image"}
#@gui : sep = separator()
#@gui : Preview Type = choice("Full","Forward Horizontal","Forward Vertical","Backward Horizontal",
#@gui : "Backward Vertical","Duplicate Top","Duplicate Left","Duplicate Bottom","Duplicate Right",
#@gui : "Duplicate Horizontal","Duplicate Vertical","Checkered","Checkered Inverse")
#@gui : Preview Split = point(50,50,0,0,200,200,200,0,10)_0
#@gui : sep = separator()
#@gui : url = link("Click here for a video tutorial","http://www.youtube.com/watch?v=H8pQfq-ybCc")
#@gui : sep = separator()
#@gui : note = note("<small>Author: <i>David Tschumperlé</i>. Latest Update: <i>2013/20/12</i>.</small>")
fx_smooth_skin :
repeat $! l[$>] split_opacity l[0] to_rgb
# Skin detection step.
if $5 +balance_gamma 128,128,128 else [0] fi
if $1==0 channels. 0 f. 1 elif $1==2 detect_skin. $2 else detect_skin. $2,$6%,$7%,$8% fi
M={iM} b. $3% *. {$M/iM} *. $4 c. 0,1
# Details smoothing step.
split_details[0] 4,$9%,$10%
+_fx_smooth_skin[2] $12,$11
j[2] .,0,0,0,0,1,.. rm[-2,-1]
*. {10^$13} + c 0,255
endl a c endl done
_fx_smooth_skin :
if $1==0 b {$2/8}%
else
if $2>0
m={im} M={iM} n 0,255
repeat int($2/5) bilateral 3%,{5*3} done
bilateral 3%,{($2%5)*3}
* {($M-$m)/255} + $m
fi
fi
fx_smooth_skin_preview :
if $-2==0
gui_split_preview "if $5 balance_gamma 128,128,128 fi if $1==0 f 1 elif $1==2 detect_skin $2 "\
"else detect_skin $2,$6%,$7%,$8% fi M={iM} b $3% * {255*$M/iM} * $4 c 0,255",${-3--1}
elif $-2==1
gui_split_preview "b $9%",${-3--1}
elif $-2==2
gui_split_preview "split_details 4,$9%,$10% k.. n 0,255",${-3--1}
elif $-2==3
gui_split_preview "split_details 4,$9%,$10% k.. _fx_smooth_skin $12,$11 n 0,255",${-3--1}
elif $-2==4
gui_split_preview "split_details 4,$9%,$10% k. n 0,255",${-3--1}
else
gui_split_preview "fx_smooth_skin $*",${-3--1}
fi
if $1==1
to_rgb
circle $6%,$7%,$8%,0.2,0,255,0
circle $6%,$7%,$8%,0.4,0xFFFFFFFF,0,255,0
line {$6-0.25*$8}%,{$7-0.25*$8}%,{$6+0.25*$8}%,{$7+0.25*$8}%,0.8,255,255,0
line {$6+0.25*$8}%,{$7-0.25*$8}%,{$6-0.25*$8}%,{$7+0.25*$8}%,0.8,255,255,0
fi