ColorBrush


Author V. C. Mohan
Date Sep 14, 2005
EMail: mohanvc

Using mask (output from MaskMaker or EMarker or Morpher or any other method) as a reference, all areas along a specified line having same marking (black or white on mask) as that of the first point of line, are colored.

Different lines may be specified at same time, as parameter 5 is an array of start x, start y, end x, end y, color values.

If lshow is true (used in test run only), the specified line is also shown in lcolor. This is to check and ensure optimum location of line. In case a new line starts from an already colored area, then its start value on mask (0 or 255) is taken as the value used by the previous line. thus preventing coloring an already colored area.

Option to stretch or shift grey value is present. If st value for shift is zero no stretch or shift takes place. It may be noted that the grey (or luma) value of image unless st is non zero is unaltered. But this can prevent some shades or colors being depicted as desired. For instance a black patch can not become white or vice versa unless shift is used. If image pixel values become less than 0 or greater than 255 they are clipped.

Color is specified in RRGGBB format and if a higher bit is set, then is used as 1yyuuvv format .

Movex and movey : the per frame proportionate values in the frame range are added to the x and y coordinates of the brush line.

In case watershed basins clip is used as a mask clip, then it is possible for a particular area to clash with the internal marking. If wshed=true then the function takes care of that situation.

RGB32, RGB24, YUY2 and YV12 formats only are supported

Details of parameters
Description Name Type Limits Default
Input clip to be colored clip none
clip to be used as mask clip none
Starting frame number to process integer within clip none
End frame number to process integer within clip and not less than start frame none
The following 5 parameters are part of an array and several such sets can be specified
brush line starting x coordinate integer within frame none
brush line starting Y coordinate integer within frame none
brush line ending x coordinate integer within frame none
brush line ending Y coordinate integer within frame none
color integer RRGGBB format or XXYYUUVV format none
The above 5 parameters are part of an array and several such sets can be specified
grey values to be shifted or stretched? shift boolean true for shift or false for stretch false
shift or stretch value st integer -255 to 255 for shift, -100 to 100 for stretch 0
change in x value first frame to last frame movex integer line should be in frame 0
change in y value first frame to last frame movey integer line should be in frame 0
line to be shown? lshow boolean true or false false
display color of line lcol integer RRGGBB format 0
Is the input mask watershed basin? wshed boolean true for yes or false for no false

Usage examples:-
# in test mode to display specified lines in red
Colorbrush(last,mask, 12,22,100,350,450,45,$cd439f, 256,129,116,255,$399ff0,lshow=false,lcol=$ff0000)
#normal usage
Colorbrush(last,mask, 12,22,100,350,450,45,$cd439f, 256,129,116,255,$1399ff0, shift = true, st=25)
#With the following script  a frame already partly colored is colored in different parts
im = converttoYV12()
#im = converttoYUY2()
#im = converttoRGB32()
grey = greyscale(im)
blur = gaussblur(grey, size = 7)
gblur = grid(blur)

#msk = maskmaker(blur,0,19,"c1",gyt=20,et=250, test=true, ft=100,fet=250)
msk = maskmaker(blur,0,19,"c1",gyt=92,et=250)
# color drops used for coloring
cd = colordrops( grey, msk,0,19,450,180,$2f0f07,350,150,$2f0f07,300,170,$2f0f07,100,130,$2f0f07,150,250,$2f0f07)

#msk2 = maskmaker(blur,0,19,"c1",gyt=100,et=190, test=true, ft=140,fet=190)
msk2 = maskmaker(blur,0,19,"c1",gyt=108,et=190)
# output frame of cd is colored
cb = colorbrush(cd,msk2,0,19,140,450,420,420,$A07000,lshow = true, lcol = $8000)
stackhorizontal(msk2.grid(), cb)
# note display of line used. In actual processing lshow will be set to false






By specifying a window in MaskMaker, the coloring can be limited to that window only.
example, The mask frame on left outside window is garbage and does not effect us.:
msk2 = maskmaker(blur,0,19,"c1",gyt=108,et=190,lx = 100, ty = 300,rx=480,by=499)
cb = colorbrush(cd,msk2,0,19,140,450,420,420,$A07000,lshow = true, lcol = $8000)
stackhorizontal(msk2.grid(), cb)


To Colorit Synopsis
To my index page
down load plugin
To Avisynth