i post my avisynth script that align two clips low and high exposer
a=ImageSource("I:\tw2\N\tiff\image%d.tiff",start=1,end=28988,fps=5).ConvertToYV12() #Low exposure clip
b=ImageSource("I:\tw2\E\tiff\image%d.tiff",start=1,end=28988,fps=5).ConvertToYV12() #High exposure clip
c = Interleave(a, b) # here it merge the low and high exposure to even and odd frames
a_cont=9.214285 #adjust this for Low exposure
b_cont=0.08 #adjust this for High exposure
a_ref = a.NonlinUSM(1.2,2.6,6.0,8.5).HighlightLimiter(1,true,1,true,100).tweak(cont=a_cont).GaussianBlur(VarY=1).MT_binarize(threshold=80).greyscale().invert() #adjust this for Low exposure if needed MT_binarize(threshold=25) and this NonlinUSM(50.2,2.6,6.0,8.5)
b_ref = b.NonlinUSM(50.2,2.6,6.0,8.5).HighlightLimiter(1,true,1,true,100).tweak(cont=b_cont).GaussianBlur(VarY=1).MT_binarize(threshold=25).greyscale().invert() #adjust this for High exposure if needed MT_binarize(threshold=25) and this NonlinUSM(50.2,2.6,6.0,8.5)
#return StackHorizontal(a_ref ,b_ref ) #Enable this only to see that Low and high exposure looks about the same and to do the adjusting to the settings when all looks ok put back this symbol # before return
c_ref = Interleave(a_ref, b_ref)
# calculate stabilization data
mdata = DePanEstimate(c_ref,trust=0.01,dxmax=32,dymax=100)
# stabilize
c_stab = DePanInterleave(c, data=mdata)
#Now the low and high exposure are align and now it separate low and high exposure frames
b2_stab = c_stab.SelectEvery(6, 2) #Here is the high exposure clip
a2_stab = c_stab.SelectEvery(6, 1) #Here is the Low exposure clip
#i now input a2_stab and b2_stab to my HDR script and it does the hdr thing and output a merge singel clip :)
you need this functions to
function HighlightLimiter(clip v, float "gblur", bool "gradient", int "threshold", bool "twopass", int "amount", bool "softlimit", int "method")
{
#SetMTMode(5) enable this if you use MT
gradient = default (gradient,true) #True uses the gaussian blur to such an extent so as to create an effect similar to a gradient mask being applied to every area that exceeds our threshold.
gblur = (gradient==true) ? default (gblur,100) : default (gblur,5.0) #The strength of the gaussian blur to apply.
threshold = default (threshold,150) #The lower the value, the more sensitive the filter will be.
twopass = default (twopass,false) #Two passes means the area in question gets darkened twice.
amount = default (amount,10) #The amount of brightness to be reduced, only applied to method=2
softlimit = default (softlimit,false) #If softlimit is true, then the values around the edges where the pixel value differences occur, will be averaged.
method = default (method, 1) #Method 1 is multiply, the classic HDR-way. Any other method set triggers a brightness/gamma approach.
amount = (amount>0) ? -amount : amount
darken=v.Tweak(sat=0).mt_lut("x "+string(threshold)+" < 0 x ?")
blurred= (gradient==true) ? darken.gaussianblur(gblur).gaussianblur(gblur+100).gaussianblur(gblur+200) : darken.gaussianblur(gblur)
fuzziness_mask=blurred.mt_edge(mode="prewitt", Y=3, U=2, V=2).mt_expand(mode="both", Y=3, U=2, V=2)
multiply = (method==1) ? mt_lut(v,"x x * 255 /") : v.Tweak(bright=amount)
multiply = (method==1) ? eval("""(twopass==true) ? mt_lutxy(multiply,v,"x y * 255 /") : multiply""") : eval("""(twopass==true) ? multiply.SmoothLevels(gamma=0.9,smode=2) : multiply""")
merged=mt_merge(v,multiply,blurred)
SetMTMode(2)
fuzzy= (softlimit==true) ? mt_merge(merged,mt_lutxy(v,merged,"x y + 2 /"),fuzziness_mask) : merged
return fuzzy
}
and this to
function NonlinUSM(clip o, float "z", float "pow", float "str", float "rad", float "ldmp")
{
z = default(z, 6.0) # zero point
pow = default(pow, 1.6) # power
str = default(str, 1.0) # strength
rad = default(rad, 9.0) # radius for "gauss"
ldmp= default(ldmp, 0.001) # damping for verysmall differences
g = o.bicubicresize(round(o.width()/rad/4)*4,round(o.height()/rad/4)*4).bicubicresize(o.width(),o.height(),1,0)
mt_lutxy(o,g,"x x y - abs "+string(z)+" / 1 "+string(pow)+" / ^ "+string(z)+" * "+string(str)+
\ " * x y - 2 ^ x y - 2 ^ "+string(ldmp)+" + / * x y - x y - abs 0.001 + / * +",U=2,V=2)
return(last)
}