Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
14th September 2015, 11:43 | #1 | Link |
The cult of personality
Join Date: May 2013
Location: Planet Vegeta
Posts: 155
|
masking dark areas
I'd like to ask about masking dark areas, like the following mask:
Code:
mask = Invert().Levels(128,1,191,0,255,coring=true) But isn't it the same as doing this: Code:
mask = Levels(50,1,80,255,0,coring=true) Am I right or not? please explain if there are better methods. |
14th September 2015, 11:59 | #2 | Link |
The cult of personality
Join Date: May 2013
Location: Planet Vegeta
Posts: 155
|
I want to see just the mask itself, how is that done via masktools2? I saw some lutxy examples but no images.
something like an edge mask, but the output video should just show the pixels affected/included by the mask. as well as other types of masks. |
14th September 2015, 14:08 | #3 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
Code:
Avisource("E:\v\xmen2.avi") A = Invert().Levels(128 ,1 ,191 ,0,255,coring=False) B = Levels(255-128 ,1 ,255-191 ,0,255,coring=False) L=StackVertical(A,B) D=Subtract(A,B) R=StackVertical(D,D) StackHorizontal(L,R)
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 17th September 2015 at 13:11. |
|
14th September 2015, 23:17 | #4 | Link |
The cult of personality
Join Date: May 2013
Location: Planet Vegeta
Posts: 155
|
In this line:
Code:
B = Levels(255-128 ,1 ,255-191 ,0,255,coring=False) Why using coring = false always? what about doing this: Code:
B = Levels(64 ,1 ,128 ,255, 0 ,coring=False) And, what about my previous question about showing masked pixels only (in above post)? What is the purpose of stackvertical/subtract/stackhorizontal lines that you wrote here? thanks Last edited by ~ VEGETA ~; 14th September 2015 at 23:19. |
15th September 2015, 00:33 | #5 | Link | |||
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
Plot input_lo,output_lo and input_hi,output_hi and join points with a straight line to visualize result. Quote:
chosen numbers and does it's own thing, I dont like that, do it if you wish but results depend somewhat on pot luck. http://forum.doom9.org/showthread.ph...12#post1722512 Quote:
Previous snippets were not creating a binary mask, but eg this would Code:
Levels(127,1.0,128,0,255,coring=false) As for the rest, you really need to say what you are trying to achieve, perhaps in a new thread (EDIT: In avisynth usage/newbie section of forum). EDIT: Fixed above, was "Plot input_lo,output_hi and input_hi,output_hi" Link given by Gavino (2 posts below) is better link than one given above.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 15th September 2015 at 13:41. |
|||
15th September 2015, 05:24 | #6 | Link | |
The cult of personality
Join Date: May 2013
Location: Planet Vegeta
Posts: 155
|
Quote:
Code:
B = Levels(64 ,1 ,128 ,255, 0 ,coring=False) No need really for a new thread because it is about masktools2. I need to make masks for dark,bright areas... I know how to do it but wanted to verify the Levels thing above. I also want to be able to see the pixels only affected by the mask... to see if it is good or not. |
|
15th September 2015, 09:40 | #7 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
|
|
15th September 2015, 13:52 | #8 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
Gavino provided link above provides probably the best description of Levels 'weirdness' that is available on-site.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
|
15th September 2015, 15:13 | #10 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Colours is correct, recent posts from #564 could be moved to a new thread (to Usage, if a moderator could oblige).
Also last three posts could be removed (incl this one). Most posts in this thread should not actually be here in the developer section, MVTools (EDIT: MaskTools) should also have a section in Avisynth Usage, but a bit late to suggest that now.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 16th September 2015 at 10:18. |
15th September 2015, 16:02 | #11 | Link | |
The cult of personality
Join Date: May 2013
Location: Planet Vegeta
Posts: 155
|
Quote:
Code:
The hell are you people doing, posting Levels in a MaskTools thread? Just use mt_lut. It's faster, more flexible, and the syntax isn't retarded. |
|
16th September 2015, 05:31 | #13 | Link | ||
The cult of personality
Join Date: May 2013
Location: Planet Vegeta
Posts: 155
|
Quote:
Quote:
I mean, it depends on the chosen values. I can use it with dark areas, and bright ones. __ My other question: Is there a way to see the areas/pixels only affected by a mask? i.e, doing an edge mask/dark areas mask and wants to see just the affected pixels from it... this is to refine the mask options and stuff. |
||
16th September 2015, 09:02 | #14 | Link |
Registered User
Join Date: Mar 2014
Posts: 308
|
Depends on what you want the not-masked areas of the picture to look like. Maybe try mt_merge(blankclip(source), source, mask, luma=true)? Or heck, just check the mask clip on its own, and have a separate tab for the original video so you can quickly flip back and forth.
__________________
Say no to AviSynth 2.5.8 and DirectShowSource! |
17th September 2015, 15:10 | #15 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Here a simple script to show differences between original and modified clip:
Code:
Avisource("E:\V\StarWars.avi") ########### Config AMP = True # AMP/Show difference clip is Amplified if True SHOW = False # AMP/Show difference clip shows dimmed original background if True TARGET= 180 # Y = (Y >= TARGET) ? SWAP : Y SWAP = 180 # ########### ORG=Last S = RT_string("(x>=%d) ? %d : x",TARGET,SWAP) # RT_Stats required to construct string (infix notation) P = MT_Polish(S) # Convert Infix notation to RPN for Masktools Changed = MT_lut(P,U=2,V=2) # Change Y: Above TARGET->SWAP : Chroma untouched D1=ClipDelta(ORG,Changed) D2=ClipDelta(ORG,Changed,Amp=AMP,Show=SHOW) Top= StackHorizontal(ORG.SubTitle("Original"),Changed.SubTitle("Changed")) Bot= StackHorizontal(D1.Subtitle("Subtract(ie difference)"),D2.Subtitle("AMP/Show")) Return StackVertical(Top,Bot) # Return Clip Difference of input clips (amp==true = Amplified, show==true = show background) Function ClipDelta(clip clip1,clip clip2,bool "amp",bool "show") { amp=Default(amp,false) show=Default(show,false) c2=clip1.levels(128-32,1.0,128+32,128-32,128+32).greyscale() c1=clip1.subtract(clip2) c1=(amp)?c1.levels(127,1.0,129,0,255):c1 return (show)?c1.Merge(c2):c1 } Code:
S = "(x>=" + String(TARGET) + ") ? " + String(SWAP) + " : x"
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 17th September 2015 at 20:13. |
18th September 2015, 13:43 | #16 | Link |
The cult of personality
Join Date: May 2013
Location: Planet Vegeta
Posts: 155
|
I've been trying to make a good edge mask, but I am not satisfied yet. I want to make a very fine sharp edge mask (mask1) and another edge mask which expands to include the noise near the edges (mask2).
then use mask1 for say sharpening, and make then subtract mask1 from mask2 (so the areas of near noise still in the result) and do some denoising there. If there is a good suggestion, please give it to me. |
19th September 2015, 04:23 | #17 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Perhaps this might assist, lets you view various edge masks. Change Name to one of supplied Mt_Edge Mode names.
Code:
Avisource("E:\v\StarWars.avi") # Mt_edge available modes # "sobel", "roberts", "laplace", "hprewitt", "prewitt", "cartoon","min/max" #Name="sobel" #Name="roberts" #Name="laplace" #Name="hprewitt" Name="prewitt" #Name="cartoon" #Name="min/max" TestEdge(Name) return Last Function TestEdge(clip c,String "Name") { # Uses only default args apart from mode Name Name=Default(Name,"sobel") edge = c.Mt_Edge(Mode=Name,U=-128,V=-128) expand = edge.Mt_Expand(U=-128,V=-128) inpand = edge.Mt_InPand(U=-128,V=-128) inflate = edge.Mt_Inflate(U=-128,V=-128) deflate = edge.Mt_deflate(U=-128,V=-128) Stack6(c,expand,inflate,edge,inpand,deflate,"Original","Expand","Inflate",Name,"Inpand","Deflate") } Function Stack2(clip c1,clip c2,string "s1",string "s2") { c1 = (s1.defined)?c1.Subtitle(s1):c1 c2 = (s2.defined)?c2.Subtitle(s2):c2 return StackHorizontal(c1,c2) } Function Stack4(clip c1,clip c2,clip c3,clip c4,string "s1",string "s2",string "s3",string "s4") { c1 = (s1.defined)?c1.Subtitle(s1):c1 c2 = (s2.defined)?c2.Subtitle(s2):c2 c3 = (s3.defined)?c3.Subtitle(s3):c3 c4 = (s4.defined)?c4.Subtitle(s4):c4 return StackVertical(StackHorizontal(c1,c2),StackHorizontal(c3,c4)) } Function Stack6(clip c1,clip c2,clip c3,clip c4,clip c5, clip c6,string "s1",string "s2",string "s3",string "s4",string "s5",string "s6") { c1 = (s1.defined)?c1.Subtitle(s1):c1 c2 = (s2.defined)?c2.Subtitle(s2):c2 c3 = (s3.defined)?c3.Subtitle(s3):c3 c4 = (s4.defined)?c4.Subtitle(s4):c4 c5 = (s5.defined)?c5.Subtitle(s5):c5 c6 = (s6.defined)?c6.Subtitle(s6):c6 return StackVertical(StackHorizontal(c1,c2,c3),StackHorizontal(c4,c5,c6)) }
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 19th September 2015 at 04:33. |
8th November 2015, 13:31 | #18 | Link | |
The cult of personality
Join Date: May 2013
Location: Planet Vegeta
Posts: 155
|
StainlessS: I tried ClipDelta, but it doesn't do what I want, perhaps I didn't explain well. I wanted something very simple like this:
Quote:
but this subtract function shows grey background all the times unless I REALLY change saturation... I wanted a more accurate one. One that shows the colored pixels and details... like when you show the pixels affected by an edgemask for example. |
|
8th November 2015, 17:19 | #19 | Link | |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
Quote:
Code:
Colorbars BilinearResize(Width/4, Height/4) ConvertToYV12 org=Last.Letterbox(8, 8, 8, 8) Changed1=org.Tweak(sat=1.01) Changed2=org.Tweak(hue=1) return StackVertical( \ StackHorizontal( \ org, \ Changed1.Subtitle("Tweak(sat=1.01)"), \ Changed1.subtract(org) \ .Subtitle("Diff x 1"), \ Changed1.subtract(org) \ .ColorYUV(cont_u=f2cuv(10), cont_v=f2cuv(10)) \ .Subtitle("Diff x 10") \ ), \ StackHorizontal( \ org, \ Changed2.Subtitle("Tweak(hue=1)"), \ Changed2.subtract(org) \ .Subtitle("Diff x 1"), \ Changed2.subtract(org) \ .ColorYUV(cont_u=f2cuv(10), cont_v=f2cuv(10)) \ .Subtitle("Diff x 10") \ ) \ ) ## rescale "normal" arguments for ColorYUV function f2cuv(float f) { return Round((f - 1.0) * 256.0) } Last edited by raffriff42; 17th March 2017 at 00:00. Reason: (fixed image link) |
|
|
|