Marking areas to be colored is important step for coloring images. A Color in Greyscale image often has a range of grey values. Therefore depending upon the grey scale value we can try to mark areas as black or white for different colors . There are two main options in this function to achieve this.
The input to MaskMaker usually is a clean Black and white Clip (may be blurred with GaussBlur to smoothen or cleaned with any other denoiser) or a partly colored clip. For Recoloring color clip will be the input. Threshold parameters are to be specified for clear area demarcation. Usually (for Y U Y formats)thresh and ethresh pair alone is enough. In case of color clips for RGB all three pairs (one pair for one color) may be used, if required. At least one threshold must be more than 0. To assist in selection of optimum parameters a test facility is provided. In test = true, the input start frame, is repeatedly processed end frame times linearly varying the parameters for each frame output.
Windowing capability eliminates unwanted computations and also prevents color leaking beyond window. Additionally already colored parts can be marked by a different value (usually 128), so that those parts will not be recolored. Therefore these facilities may invariably be used. Several calls with different set of parameters may be required for coloring different areas of an image.
Types "a1" and "c1" are the main options suitable for Grey Scale (black and white) image, as only one plane has varying image values. For colored clip input "c2" checks all 3 planes and if any two of 3 planes are within threshold it is marked. In "c3" option all 3 planes must satisfy the threshod limits for marking. Type a1 outputs mask with which are odd multiples of the threshold range. By specifying small values for thresholds in this a1 option similar to contour lines can be drawn.
The output of this function is used by ColorBrush, Colordrops, ColorLine, ColorFills , CrossFill and Inlay functions. Using Morpher after this filter, in certain cases, separates areas better.
RGB32, RGB24, YUY2 and YV12 formats are supported.
Description | Name | Type | Limits | Default |
Input clip | clip | none | ||
Starting frame number to process | sf | integer | within clip | 0 |
End frame number to process | ef | integer | within clip and not less than sf | last frame |
method of demarcation | type | string | "a1" "c1" "c2" "c3" | "c1" |
lower threshold for Green or Y values | gyt | integer | 0 to 255 | 20 |
lower threshold for red or U values | rt | integer | 0 to 255 | 0 |
lower threshold for blue or V values | bt | integer | 0 to 255 | 0 |
values to be marked as white or black | white | boolean | true for white or false for black | false |
upper threshold for Green or Y values | et | integer | 0 to 255, not less than thresh | 40 |
upper threshold for red or U values | ert | integer | 0 to 255, not less than rthresh | 0 |
upper threshold for blue or V values | ebt | integer | 0 to 255, not less than bthresh | 0 |
Is this a test run? | test | boolean | true for test or false for no | false |
final lower threshold for Green or Y values | ft | integer | 0 to 255 | 120 |
final lower threshold for red or U values in test | frt | integer | 0 to 255 | 0 |
final lower threshold for blue or V values in test | fbt | integer | 0 to 255 | 0 |
final upper threshold for Green or Y values in test | fet | integer | 0 to 255, not less than ft | 240 |
final upper threshold for red or U values in test | fert | integer | 0 to 255, not less than frt | 0 |
upper threshold for blue or V values in test | febt | integer | 0 to 255, not less than fet | 0 |
Process window left x at start frame | lx | integer | within frame, less than rx-4 | 0 |
Process window top y at start frame | ty | integer | within clip, less than by-4 | 0 |
Process window right x at start frame | rx | integer | within clip, more than lx+4 | frame width-1 |
Process window bottom y at start frame | by | integer | within frame, more than ty+4 | frame height-1 |
exclude already colored parts? | xcol | boolean | true for exclude or false | true |
color value to use to mark already colored parts | col | integer | 0 to 255 | 128 |
Process window left x at end frame | elx | integer | within frame, less than erx-4 | lx |
Process window top y at end frame | ety | integer | within clip, less than eby-4 | ty |
Process window right x at end frame | erx | integer | within clip, more than elx+4 | rx |
Process window bottom y at end frame | eby | integer | within frame, more than ety+4 | by |
g=GaussBlur() # for testing frame 0 with 50 steps gyt varying between 1 and 201, et varying between 21 and 221 maskmaker(g,0,50,"c1",gyt=1,et=21, test=true, ft=201,fet=221) #for use by other functions maskmaker(g,type="c1", gyt=15,et=100, lx=440,rx=480,ty=380) # for the display below script used :- im = imagereader("E:\images\canyon.jpg", end = 20).converttoYV12().crop(100,0,300,400) grey = greyscale(im) blur = gaussblur(grey, size = 7) gblur = grid(blur) #test was done with the commented out line below #msk = maskmaker(blur,0,19,"c1",gyt=20,et=170, test=true, ft=100,fet=170) msk = maskmaker(blur,0,19,"c1",gyt=70,et=166, test=false, ft=70,fet=166).grid() stackhorizontal(grey, msk)
To Colorit Synopsis | |||
To my index page | |||
down load plugin | |||
To Avisynth |