HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
EQuid, ZebraTest() mod.
Code:
Function Equid(clip c,Float "Thresh",Float "Lo",Float "Hi",Int "CMad",Int "Bands",
\ Bool "Zebroid",Float "zThresh",Float "zLo",Float "zhi",Int "zCMad",Int "zFunc",
\ Bool "Subs") {
/*
Equid, Hoofed mammal with Mane (or an on-line £1.00 coin).
Equid, a ZebraTest() script mod, revamped as a script function.
Main advantage is the number of bars are selectable (from highest downwards), eg Bands=1 selects bar 5, ie YInRange bar.
The least useful [ie YPlaneMin(func band=0) and YPlaneMax(func band=1)] are included only if selecting Bands=6 and 5
respectively.
In addition to the normal Zebra() functionality provided in ZebraTest script, this effort allows selection of
Zebroid functionality (when Zebroid bool = true, where the 'z...' args become relevant).
If Zebroid is applied to the incoming clip, then the Zebra bands are created using the Zebroid result as source.
See ZebraTest() script for further usage. https://forum.doom9.org/showthread.php?t=167663
*/
c PIX=48
Thresh=Default(Thresh,0.0) Lo=Round(Default(Lo,128)) Hi=Round(Default(Hi,255.0)) CMad=Default(CMad,1) Bands=Default(Bands,4)
Zebroid=Default(Zebroid,false) zThresh=Default(zThresh,0.0)
zLo=Round(Default(zLo,128)) zHi=Round(Default(zHi,255)) zCMad=Default(zCMad,1) zFunc=Default(zFunc,4) Subs=Default(Subs,True)
Assert(1 <= Bands <= 6,String(Bands,"ZebBoard: 1 <= Bands <= 6(%.0f)"))
Zebroid?Assert(0 <= zFunc <= 5,String(Bands,"ZebBoard: 0 <= zFunc <= 5(%.0f)")):NOP
zFnName=Select(zFunc,"Min","Max","Mx-Mn","Med","Ave","Yir")
(Zebroid) ? Zebroid(Threshold=zThresh,lo=Round(zLo),hi=Round(zHi),cmad=zCMad,func=zFunc) : NOP
Z1=Zebra(row=true,threshold=Thresh,lo=Round(LO),hi=Round(HI),pix=PIX,cmad=CMAD).Crop((6-Bands)*Pix,0,Pix*Bands,0)
Z2=Zebra(row=false,threshold=Thresh,lo=Round(LO),hi=Round(HI),pix=PIX,cmad=CMAD).Crop(0,(6-Bands)*Pix,0,Pix*Bands)
Z1=Z1.SUBTITLE("Row\nTrue", x=(Bands)*PIX/2-15,y=Z1.Height/2-10,Text_Color=$FFFFFF,lsp=0)
Z2=Z2.SUBTITLE("Row False",x=Z2.Width/2-37,y=(Bands)*PIX/2-10,Text_Color=$FFFFFF)
(Subs)?SubTitle("PIX="+String(PIX),y=height/2-50,Text_Color=$FFFFFF,Align=5):NOP
(Subs)?SubTitle("Thresh="+String(Thresh),y=height/2-30,Text_Color=$FFFFFF,Align=5):NOP
(Subs)?SubTitle("LO="+String(LO)+" HI="+String(hi),y=height/2-10,Text_Color=$FFFFFF,Align=5):NOP
(Subs)?SubTitle("CMAD="+String(CMAD),y=height/2+10,Text_Color=$FFFFFF,Align=5):NOP
(Subs&&Zebroid)?Subtitle(String(zThresh,"zThresh=%f\n")+String(zLo,"zLo=%.0f ")+String(zHi,"zHi=%.0f\n")+
\ String(zCMad,"zCMad=%.0f\n")+String(zFunc,"zFunc=%.0f [")+zFnName+"]",y=height/2+40,Text_Color=$FFFFFF,Align=5,lsp=0) : NOP
BLANK=Z2.BlankClip(width=Bands*PIX,color=$808080)
BLANK=(Bands>=6)?BLANK.SUBTITLE("MIN",x=(Bands-6) *PIX+PIX/2-15,y=(Bands-6)*PIX+PIX/2-10,Text_Color=$FFFFFF) :BLANK
BLANK=(Bands>=5)?BLANK.SUBTITLE("MAX",x=(Bands-5) *PIX+PIX/2-15,y=(Bands-5)*PIX+PIX/2-10,Text_Color=$FFFFFF) :BLANK
BLANK=(Bands>=4)?BLANK.SUBTITLE("MX-MN",x=(Bands-4)*PIX+PIX/2-24,y=(Bands-4)*PIX+PIX/2-10,Text_Color=$FFFFFF) :BLANK
BLANK=(Bands>=3)?BLANK.SUBTITLE("MED",x=(Bands-3) *PIX+PIX/2-15,y=(Bands-3)*PIX+PIX/2-10,Text_Color=$FFFFFF) :BLANK
BLANK=(Bands>=2)?BLANK.SUBTITLE("AVE",x=(Bands-2) *PIX+PIX/2-15,y=(Bands-2)*PIX+PIX/2-10,Text_Color=$FFFFFF) :BLANK
BLANK =BLANK.SUBTITLE("YIR",x=(Bands-1) *PIX+PIX/2-15,y=(Bands-1)*PIX+PIX/2-10,Text_Color=$FFFFFF)
Return StackVertical(StackHorizontal(Z1),StackHorizontal(Z2,BLANK))
}
EDIT: Added Round() on internal Lo/Hi zLo/ZHi args.
Code:
Imagesource("DQ-Tools.jpg",end=0)
Return Equid(CMad=3,Bands=3)
#Return Equid(CMad=10,Bands=3,Zebroid=True,zFunc=5)
EDIT:
q] What use is it ?
a] No idea, but I'm experimenting with it in Spatial Alignment of clips [EQuid, as a viewer for perusal].
Last edited by StainlessS; 15th August 2018 at 15:14.
|