Log in

View Full Version : colorrange masking (masktools,colorit bugs)


jmac698
6th April 2007, 21:49
keywords: selecting colorrange, colorit bug, maskmaker bug, masktools bug, avsp bug, equals bug in mask tools, = not working in masktools, avsp colors display error,yv12lut bug, yv12lut green

I've been trying for hours, to do this simple task,
however three plugins I've tried have bugs which make
it impossible. Thus I will state the bugs in masktools,
colorit. Tested with avisynth 2.56.

Masktools 2a30


blankclip().converttoyv12()
mt_lut(yexpr="x 16 = 255 128 ?",uexpr="128",vexpr="128",y=3,u=3,v=3)

Table
-----
x 16 = false (expected true)
x 16 < false
x 17 < true
x 16 <= true
The equality operation doesn't work at all. Not equal does work however, and is a workaround:
colorbars(pixel_type="YV12")
mt_lut(yexpr="x 161 != 128 x ?",uexpr="128",vexpr="128",y=3,u=3,v=3)


Masktools 1.58
colorbars(pixel_type="YV12")
yv12lut()
returns a bright green image, expected original image

ColorIt
maskmaker() has no named parameter "thresh" or "ethresh". I played with
some other names, like gryt, but didn't find expected behavior.
Sample (doesn't work)
MaskMaker(type="c3",thresh=20,ethresh=120,rthresh=0,erthresh=255,bthresh=85,ebthresh=120,lx=70,rx=646,ty=368,by=443)


AVSP bug 1.3.7
Try this, set options, program settings, video1, display YUV, click on yellow rectangle,
is reads 159 instead of 161.
colorbars(pixel_type="YV12")


Now my objective: to make white any colors in a range, like 150<=y<=170.
I could do this awkwardly with core and crush, or a selective colortweaker.
I can't believe I found bugs in 4 programs, I must be cursed :)

gzarkadas
7th April 2007, 00:02
The equality operation doesn't work at all.

The equality operator in masktools v2 is == (change from v1).

For what you are trying to do, mt_lut with a yexpr = "x 150 - 170 x - & 255 0 ?" could be a good starting point (thresholds are those of the example).

jmac698
7th April 2007, 01:24
masktools 2a30

colorbars(pixel_type="YV12")
mt_lut(yexpr="x 161 == 0 x ?",uexpr="128",vexpr="128",y=3,u=3,v=3)

masktools/documentation/mt_masktools.html#reverse_polish_notation
We can create boolean values with the following comparaison operators : "<", ">", "<=", ">=", "!=", "==".

My bad, and thanks :)

colorbars(pixel_type="YV12")
rangelow=130#inclusive, this convention is only way to include extremities
rangehigh=161
mapto="235"#use 235 for a pure white mask.
mapelse="x"#x means leave as is. Use 0 for a pure white mask.
arg1="x "+string(rangelow-1)+" - "+string(rangehigh+1)+" x - & "+mapto+" "+mapelse+" ?"
arg2="x "+string(rangelow)+" >= x "+string(rangehigh)+" <= & "+mapto+" "+mapelse+" ?"
mt_lut(yexpr=arg2,uexpr="128",vexpr="128",y=3,u=3,v=3)
subtitle(arg2)
It seems any positive number is TRUE and that mt+lut works with >8bit numbers. (your example string was off by 1, btw, x 149 - 171 x -).

vcmohan
7th April 2007, 04:49
ColorIt
maskmaker() has no named parameter "thresh" or "ethresh". I played with
some other names, like gryt, but didn't find expected behavior.
Sample (doesn't work)
MaskMaker(type="c3",thresh=20,ethresh=120,rthresh=0,erthresh=255,bthresh=85,ebthresh=120,lx=70,rx=646,ty=368,by=443)


Sorry I did not update documentation after I changed some parameter names. The full list of parameter names is:

sf, ef, type,gyt,rt, bt, white, et, ert, ebt, test, ft, fr, fb, fet, fert, febt, lx, ty, rx, by, xcol, col, elx, ety, erx, eby
Documentation and dll are updated. Once again sorry for any inconvenience and thanks for pointing out the mistakes.