View Full Version : parameter zero for mt_square
leon1789
22nd April 2020, 18:10
Hello,
I don't understand why these two first lines don't give the same result.
a = ...
b = mt_luts(a,a,"max",mt_square(1,false),"y x - abs",Y=3,U=0,V=0)
c = mt_luts(a,a,"max",mt_square(1,true),"y x - abs",Y=3,U=0,V=0)
stackvertical(b.coloryuv(analyze=true),c.coloryuv(analyze=true))
because the center pixel doesn't matter, this two first lines would give the maximum difference between the surrounding pixels and the center.
But it's not , as stackvertical shows! Thank you for your explanations.
https://zupimages.net/up/20/17/d13y.jpg
StainlessS
22nd April 2020, 21:47
Dont know and I'm exhausted, this lockdown thing got me knackered, gonna get some shuteye.
But, maybe take a peek here, it might help some:- https://forum.doom9.org/showthread.php?p=1780314#post1780314
you might also want to take a gander at the strings produced for ,mt_square(1,false), and ,mt_square(1,true).
SQ0=MT_square(1,false)
SQ1=MT_square(1,true)
RT_DebugF("MT_square(1,false)='%s'",SQ0)
RT_DebugF("MT_square(1,true )='%s'",SQ1)
MessageClip("Done")
RT_DebugF: MT_square(1,false)='-1 0 0 -1 0 0 0 1 1 0 '
RT_DebugF: MT_square(1,true )='-1 -1 -1 0 -1 1 0 -1 0 0 0 1 1 -1 1 0 1 1 '
EDIT:
because the center pixel doesn't matter, this two first lines would give the maximum difference between the surrounding pixels and the center.
Additional coordinates
@
@@@ Top one, 5 coords : MT_square(1,false)
@
@@@
@@@ Bot one 9 coords : MT_square(1,true)
@@@
EDIT:
Using Input image from this post:- https://forum.doom9.org/showthread.php?p=1780335#post1780335
https://i.postimg.cc/ZRVZ6xyp/mtexpand-test-00-org.png (https://postimages.org/)
a=ImageSource(".\mtexpand-test-00-org.png").ConvertToYV24()
a=a.Letterbox(0,14,0,0) # Get rid of Subtitle (black is at level 16)
a=a.Levels(16,1.0,235,0,255,coring=false) # 0->255
#return a
SQ0=MT_square(1,false)
SQ1=MT_square(1,true)
b = mt_luts(a,a,"max",SQ0,"y x - abs",Y=3,U=-128,V=-128)
c = mt_luts(a,a,"max",SQ1,"y x - abs",Y=3,U=-128,V=-128)
a = a.PointResize(640,480)
b = b.PointResize(640,480)
c = c.PointResize(640,480)
#return a
#return b
#return c
a=a.coloryuv(analyze=true)
b=b.coloryuv(analyze=true)
c=c.coloryuv(analyze=true)
#return a
#return b
#return c
stackhorizontal(a,b,c)
Result
https://i.postimg.cc/c4T9Z5GQ/Square-01.jpg (https://postimg.cc/BXLcBp66)
leon1789
23rd April 2020, 10:43
Thank you very much for all!
So mt_square(1,false) and mt_diamond(1,true) are the same relative coordinates list.
It's a bug, I think because :
http://manao4.free.fr/mt_masktools.html#mt_square_mt_circle_mt_diamond
Thanks to your explanations, i will work very well now!
StainlessS
23rd April 2020, 10:54
Beats me, both produce same as mt_square(1,false)
SQ0=MT_diamond(1,false)
SQ1=MT_diamond(1,true)
RT_DebugF("MT_diamond(1,false)='%s'",SQ0)
RT_DebugF("MT_diamond(1,true )='%s'",SQ1)
MessageClip("Done")
__END__
RT_DebugF: MT_diamond(1,false)='-1 0 0 -1 0 0 0 1 1 0 '
RT_DebugF: MT_diamond(1,true )='-1 0 0 -1 0 0 0 1 1 0 '
RT_DebugF: MT_square (1,false)='-1 0 0 -1 0 0 0 1 1 0 ' # EDIT: Copied from prev post
BOTH give # EDIT: All three
@
@@@
@
leon1789
23rd April 2020, 10:56
Yes!
So this is a general bug of the parameter zero , isn't it ?
StainlessS
23rd April 2020, 11:04
No idea, forgot how this stuff works, (I just got up and am still feelin' knackered) :)
Groucho2004
23rd April 2020, 11:10
I just got up and am still feelin' knackered :)Just remember, if you're over 50, getting up in the morning and don't have any pain anywhere or not feeling knackered - you know you're dead.
Did you stock up on beer?
StainlessS
23rd April 2020, 11:16
Well, guess I'm not dead yet.
I found a 4 pack in the cupboard [its just like christmas when that happens :) ]
so did not go out yesterday, gotta doit today though.
You young wippersnappers got it made :)
StainlessS
23rd April 2020, 11:33
Using masktools2_a25(XP)_2.0.48.dll (on avs v2.58)
#return version
SQ0=MT_square(1,false)
RT_DebugF("MT_Square(1,false)='%s'",SQ0)
RC0=MT_rectangle(1,false)
RT_DebugF("MT_rectangle(1,1,false)='%s'",RC0)
CC0=MT_circle(1,false)
RT_DebugF("MT_circle(1,false)='%s'",CC0)
CC1=MT_circle(1,true)
RT_DebugF("MT_circle(1,true)='%s'",CC1)
EL0=MT_ellipse(1,false)
RT_DebugF("MT_ellipse(1,1,false)='%s'",EL0)
EL1=MT_ellipse(1,true)
RT_DebugF("MT_ellipse(1,1,true)='%s'",EL1)
DM0=MT_diamond(1,false)
RT_DebugF("MT_diamond(1,false)='%s'",DM0)
DM1=MT_diamond(1,true)
RT_DebugF("MT_diamond(1,true )='%s'",DM1)
LS0=MT_losange(1,false)
RT_DebugF("MT_losange(1,1,false)='%s'",LS0)
LS1=MT_losange(1,true)
RT_DebugF("MT_losange(1,1,true)='%s'",LS1)
MessageClip("Done")
ALL SAME
00002980 667.03613281 [4848] RT_DebugF: MT_Square(1,false) ='-1 0 0 -1 0 0 0 1 1 0 '
00002985 667.04010010 [4848] RT_DebugF: MT_rectangle(1,1,false) ='-1 0 0 -1 0 0 0 1 1 0 '
00002983 667.03784180 [4848] RT_DebugF: MT_circle(1,false) ='-1 0 0 -1 0 0 0 1 1 0 '
00002984 667.03839111 [4848] RT_DebugF: MT_circle(1,true) ='-1 0 0 -1 0 0 0 1 1 0 '
00002987 667.04357910 [4848] RT_DebugF: MT_ellipse(1,1,false) ='-1 0 0 -1 0 0 0 1 1 0 '
00002988 667.04516602 [4848] RT_DebugF: MT_ellipse(1,1,true) ='-1 0 0 -1 0 0 0 1 1 0 '
00002981 667.03668213 [4848] RT_DebugF: MT_diamond(1,false) ='-1 0 0 -1 0 0 0 1 1 0 '
00002982 667.03729248 [4848] RT_DebugF: MT_diamond(1,true ) ='-1 0 0 -1 0 0 0 1 1 0 '
00002989 667.04681396 [4848] RT_DebugF: MT_losange(1,1,false) ='-1 0 0 -1 0 0 0 1 1 0 '
00002990 667.04840088 [4848] RT_DebugF: MT_losange(1,1,true) ='-1 0 0 -1 0 0 0 1 1 0 '
@
@@@
@
Should it be this when zero=false
@
@ @
@
So if its a bug, it aint a new one.
EDIT: All 10 of above same
mt_square : int radius(1), bool zero(true)
Creates a relative coordinates list that can be used in luts, mt_expand and mt_inpand
zero decides whether the center of the form is included or not.
I'm unclear about what zero is supposed to do, so dont know if bug or not,
does it mean that the '@' coord in red at end of code block should not be included [omitted from the string] ?
EDIT: Or does it mean that center pixel is included in length of radius[or something], in which case may not be a bug.
@@ # Two pixels, length might be counted as 2, or distance between them ie 1 [single pixel, point having zero dimension].
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.