unalias rd unalias wd string flatdir './' ! Read them in do chip=3,3 if chip==1 string file '{flatdir}/ota_pc%i1_version1' chip else string file '{flatdir}/ota_wf%i1_version1' chip end_if rd $chip {file} ! if chip==1 ! mul $chip c=(12.9/28.3)^2 ! end_if !! copy $chip+10 $chip ! oneover $chip ! Get edges call edge chip chip 1 end_do ! Get distortion coeffs !call ./pos !$'rm' a.inp !printf 'edge.dat' >>./a.inp !$ edge < a.inp edge=30 do i=3,3 ! Fix the distortion ! call ./fixedge i i 1 ! Now we have a "straight" edge (hopefully!) in $i+10 abx $i+30 high=hc abx $i+40 high=hr hr=int[hr] hc=int[hc] box 1 nr=799-(hr+edge)-1 sr=hr+edge nc=hc+edge sc=1 box 2 nr=799-(hc+edge)-1 sr=hc+edge nc=hr+edge sc=1 box 3 nr=hr+edge nc=hc+edge sc=1 sr=1 ! Fix box 1 copy 49 $i smooth 49 fwr=41 runmean div $i 49 box=1 copy 48 49 rowfit 48 fit=hc+21,hc+101 ncoef=3 poly mul $i 48 box=1 box 4 nr=1 sr=hr+edge+1 nc=800 sc=1 copy 47 48 box=4 stretch 45 47 start=1 vert size=hr+edge rotate $i transpose copy 49 $i smooth 49 fwr=41 runmean div $i 49 box=2 copy 48 49 rowfit 48 fit=hr+21,hr+101 ncoef=3 poly mul $i 48 box=2 box 4 nr=1 sr=hc+edge+1 nc=800 sc=1 copy 47 48 box=4 stretch 46 47 start=1 vert size=hc+edge rotate $i transpose div $i $i box=3 rotate 46 transpose add 45 46 div 45 c=2 mul $i 45 box=3 ! oneover $i ! if i==1 ! string file '/usr/tmp/iflat_{filt}_pc%i1' i ! else ! string file '/usr/tmp/iflat_{filt}_wf%i1' i ! end_if pause wd $i {file} wfpc end_do end