Advertisement
Guest User

Retinex filter, implemented in G'MIC

a guest
Sep 13th, 2016
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.14 KB | None | 0 0
  1. #@gmic retinex : _value_offset>0,_colorspace={ hsi | hsv | lab | ycbcr },0<=_min_cut<=100,0<=_max_cut<=100,_sigma_low>0,_sigma_mid>0,_sigma_high>0
  2. #@gmic : Apply multi-scale retinex algorithm on selected image to improve color consistency.
  3. #@gmic : (as described in the page http://www.ipol.im/pub/art/2014/107/).
  4. #@gmic : Default values: 'offset=1', 'colorspace=lab', 'min_cut=1', 'max_cut=1', 'sigma_low=15','sigma_mid=80' and 'sigma_high=250'.
  5. retinex : -check "${1=5}>0 && ${3=1}>=0 && $3<=100 && ${4=1}>=0 && $4<=100 && ${5=15}>0 && ${6=80}>0 && ${7=250}>0" -skip "${2=lab}"
  6.   -e[^-1] "Apply Retinex color consistency algorithm on image$?, with value offset $1, colorspace '$2', cuts ($3,$4) and sigmas (${5-7})."
  7.   -v -
  8.   -if {;'$2'=='hsi'} mode=hsi_i
  9.   -elif {;'$2'=='hsv'} mode=hsv_v
  10.   -elif {;'$2'=='lab'} mode=lab_l
  11.   -elif {;'$2'=='ycbcr'} mode=ycbcr_y
  12.   -else -v + -error[0--2] "Command '-retinex': Invalid colorspace argument '$2'."
  13.   -endif
  14.   -ac "-_retinex $1,${3--1}",$mode
  15.   -v +
  16.  
  17. _retinex :
  18.   -- {im-$1} {[w,h,d,s]}
  19.   -repeat 3 --b[0] {arg(1+$>,${4-6})} --/[0,-1] -rm.. -log. -+[1,-1] -done
  20.   -rm[0] -c $2%,{100-$3}% -n 0,255
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement