VideoHelp Forum
+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 56 of 56
Thread
  1. That is certainly something to consider except for the fact that I want to apply Avisynth filters to it. So even if I get Vegas and mask these parts, how can I go about completing my task?

    So for example, I would want to apply McTemporalDenoise at strong settings to the hair and face, while perfectly masking the lines and the dark background (since McTemporalDenoise is terrible with dark scenes and figures). Then on the second pass, I'd use smdegrain() to degrain the entire clip, but with the focus on the dark backgrounds and figures.
    Quote Quote  
  2. I have tried line masking, but that doesn't cover dark figures and backgrounds. Mt_binarize does that, but it doesn't mask the lines as accurately. I wish there was some way to merge the two (mt_edge and mt_binarize) and create a mask that can complete both tasks, masking lines AND dark backgrounds/figures.
    Quote Quote  
  3. Originally Posted by Betelman View Post
    That is certainly something to consider except for the fact that I want to apply Avisynth filters to it. So even if I get Vegas and mask these parts, how can I go about completing my task?

    So for example, I would want to apply McTemporalDenoise at strong settings to the hair and face, while perfectly masking the lines and the dark background (since McTemporalDenoise is terrible with dark scenes and figures). Then on the second pass, I'd use smdegrain() to degrain the entire clip, but with the focus on the dark backgrounds and figures.
    If you are using other programs to generate masks, you export the masks from the other program to use in avisynth
    Quote Quote  
  4. Originally Posted by Betelman View Post
    I have tried line masking, but that doesn't cover dark figures and backgrounds. Mt_binarize does that, but it doesn't mask the lines as accurately. I wish there was some way to merge the two (mt_edge and mt_binarize) and create a mask that can complete both tasks, masking lines AND dark backgrounds/figures.
    Use a line mask for lines, luma mask for dark areas .

    You can add masks , subtract masks, combine masks . Look at the masktools operators
    Quote Quote  
  5. Oh I didn't know I could do that (mask it with one program, and proceed with Avisynth). I was under the impression that Avisynth would not recognize the mask, since it wasn't created using Avisynth to begin with. Interesting. Well, it's back to the old drawing board for me. I'll keep you posted. Thanks PDR and JohnMeyer.
    Quote Quote  
  6. Holy moly, Vegas is 400 bucks! I want to restore my cartoons, but not THAT bad!!
    Quote Quote  
  7. Originally Posted by Betelman View Post
    That is certainly something to consider except for the fact that I want to apply Avisynth filters to it. So even if I get Vegas and mask these parts, how can I go about completing my task?
    I do this all the time. I do something in Vegas and then use the free frameserver (from Debugmode.com) to serve into AVISynth. If you want to pass AVISynth the mask, then in Vegas replace the section that is masked with pure black. Even in animation, nothing is pure black. Then, in AVISynth you just look for pure black, which is a trivial operation, and do whatever you want.

    Originally Posted by Betelman View Post
    Holy moly, Vegas is 400 bucks! I want to restore my cartoons, but not THAT bad!!
    Vegas Pro is indeed expensive, but Vegas Movie Studio is less than $50, and it has the Secondary Color Corrector, as I stated in my last post. What's more, you can get it for next to nothing if you order a version that is one or two versions out of date. I still do 98% of my editing on versions (I have four different Vegas installation) that are almost ten years old. You really don't need the latest version, at all. I did zero research, and here is one listing that for the previous version (14) for $19:

    https://www.amazon.com/VEGAS-Movie-Studio-14-Platinum/dp/B01NBYOMJD/

    If you are willing to deal with eBay, here is an in-the-box version 13 (which is the latest version I own, and perfectly adequate for doing anything) for $6.50, shipped.
    Quote Quote  
  8. And I can use masking and rotoscoping with that $6.50 program?
    Quote Quote  
  9. Originally Posted by Betelman View Post
    And I can use masking and rotoscoping with that $6.50 program?
    You can download the trial, for free, and find out for yourself.
    Quote Quote  
  10. I finally downloaded the trial, and I have no other way of knowing how to put this because I'm actually not really used to working with these type of editors but: What on earth am I supposed to do with this software? It is extremely overwhelming. There have to be more than three million options and that's just for saving the thing as a project. I don't understand why or how anyone can work with this arrogant, overly engineered P.O.S. Heaven forbid there's just a simple button that says "color corrector", where you click it and then the options are there. No, you have to go through an enchanted forest just to find the damn thing. Why did they design it like this? Who has the ******* patience? The task in and of itself is difficult as it is, so they can't at the very least make the interface user friendly?
    Quote Quote  
  11. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Yeah, they should take a lesson from AVISynth's stellar user interface. /S

    Scott
    Quote Quote  
  12. Just for fun I made a function that works like MaskHS() but works with YUV:

    Code:
    function MaskYUV(clip c, int "min_y", int "max_y", int "min_u", int "max_u", int "min_v", int "max_v")
    {
        min_y = default(min_y, 0)
        max_y = default(max_y, 255)
        min_u = default(min_u, 0)
        max_u = default(max_u, 255)
        min_v = default(min_v, 0)
        max_v = default(max_v, 255)
    
        mask_y = Overlay(mt_binarize(c,min_y), mt_binarize(c, max_y, upper=true), mode="multiply")
        mask_u = Overlay(mt_binarize(c.UtoY(),min_u), mt_binarize(c.UtoY(), max_u, upper=true), mode="multiply").PointResize(c.width, c.height)
        mask_v = Overlay(mt_binarize(c.VtoY(),min_v), mt_binarize(c.VtoY(), max_v, upper=true), mode="multiply").PointResize(c.width, c.height)
    
        fullmask = Overlay(mask_v, mask_u, mode="multiply")
        fullmask = Overlay(fullmask, mask_y, mode="multiply")
        return(fullmask)
    }
    Using it like this:

    Code:
    ImageSource("image1.jpg", start=0, end=240, fps=23.976) 
    ConvertToYV12()
    
    a=last
    b=blankclip(a, color=color_green)
    
    m1 = MaskYUV(min_y=50, max_y=80, min_u=90, max_u=120, min_v=150, max_v=175)
    m2 = MaskYUV(min_y=35, max_y=50, min_u=110, max_u=115, min_v=150, max_v=160)
    mask = Overlay(m1, m2, mode="add")
    
    Overlay(a,b,mask=mask)
    gives:

    Image
    [Attachment 53541 - Click to enlarge]


    As you can see, I built two masks, one for the lighter parts of the hair, one for the darker parts of the hair, then added them together.
    Quote Quote  
  13. Just for fun, or just to help?

    I don't believe I asked for anyone here to toy around with my question "just for fun", so I'll take it you did it to help. In which case, just say so. Don't try to be all suave about it Jagabo, I promise it won't take anything away from your super-duper macho-manic Monday.

    Now, your mask is an interesting one, but I have to ask: I notice a pattern in your mask of min/max numbers. What is that all about? (In plain English, if possible)
    Quote Quote  
  14. Those are YUV bounding boxes around the two main colors in her hair. You can get the YUV values in many ways. One is like this:

    Code:
    ImageSource("image1.jpg")
    ConvertToYV24()
    Crop(240,34, 24,24) # look at just the brighter hair color
    StackHorizontal(greyscale(), UtoY(), VtoY())  # view Y, U, V planes as greyscale
    ConvertToRGB(matrix="pc.601") # convert to RGB with pc.601 matrix to retain actual values (Y=R=G=B)
    Image
    [Attachment 53581 - Click to enlarge]


    Then read the values of the three blocks in an editor, with a screen RGB reader, etc. You can see that the Y block is about 63, the U block about 100, and the V block about 168. The the min values are set a little lower than those, the max values a little higher. Adjust to suit.

    Code:
    min_y=50, max_y=80,     min_u=90, max_u=120,     min_v=150, max_v=175
    Quote Quote  
  15. Another way to get YUV values is to use ColorYUV(analyze=true):

    Code:
    ImageSource("image1.jpg") 
    
    ConvertToYV24()
    Crop(240,34, 24,24)  # look at just the brighter hair color
    PointResize(640,256) # needs to big enough to show text
    ColorYUV(analyze=true) # show YUV stats
    Image
    [Attachment 53584 - Click to enlarge]
    Quote Quote  
  16. Well that's gonna be a load to study. Thanks. I'll check into it this weekend and come back with maybe 1 or 2 more questions or comments.
    Quote Quote  
  17. It works just like MaskHS except it uses YUV ranges rather than HS ranges.
    Quote Quote  
  18. Ok, just by looking at this, please tell me if I have this correctly:

    1. You checked the YUV color values of her hair on an editor. The editor showed you what the average/max/min values are for each channel on her hair color (the Y luma, the U chorma and the V chroma).

    2. You then took those values and incorporated them in your mask, adjusting the values little lower than the minimum, and a little higher than the maximum, according to coverage needed.

    am I correct so far?
    Last edited by Betelman; 29th May 2020 at 17:46.
    Quote Quote  
  19. Also, this is based on the understanding that, just like the RGB colorspace, YUV rangers from 0 (0 being total black) to 255 (255 being total white), yes?
    Quote Quote  
  20. Originally Posted by Betelman View Post
    Ok, just by looking at this, please tell me if I have this correctly:

    1. You checked the YUV color values of her hair on an editor. The editor showed you what the average/max/min values are for each channel on her hair color (the Y luma, the U chorma and the V chroma).

    2. You then took those values and incorporated them in your mask, adjusting the values little lower than the minimum, and a little higher than the maximum, according to coverage needed.

    am I correct so far?
    Yes.

    Originally Posted by Betelman View Post
    Also, this is based on the understanding that, just like the RGB colorspace, YUV rangers from 0 (0 being total black) to 255 (255 being total white), yes?
    And yes. Though note that rec.601 video only Y values from 16 to 235, and U/V values from 16 to 240 are "legal" colors.

    Note that MaskHS() usually makes more sense for this type of masking. When you have an object of a solid color in light and shade it typically has the same hue in both the bright and dark areas.

    Image
    [Attachment 53591 - Click to enlarge]


    Notice how all the shades (dark to bright) of the three different hues (yellow, red, blue) of the hot air balloon fall in lines from the center (low saturation, grey-ish) toward the edges (high saturation, pure color).

    Here's an animation that shows 10 degree wide hue wedges (across all saturations), 10 percent wide saturation rings (across all hues), and the combination of the two:

    Code:
    function GreyRamp()
    {
       black = BlankClip(color=$000000, width=1, height=256, pixel_type="RGB32")
       white = BlankClip(color=$010101, width=1, height=256, pixel_type="RGB32")
       StackHorizontal(black,white)
       StackHorizontal(last, last.RGBAdjust(rb=2, gb=2, bb=2))
       StackHorizontal(last, last.RGBAdjust(rb=4, gb=4, bb=4))
       StackHorizontal(last, last.RGBAdjust(rb=8, gb=8, bb=8))
       StackHorizontal(last, last.RGBAdjust(rb=16, gb=16, bb=16))
       StackHorizontal(last, last.RGBAdjust(rb=32, gb=32, bb=32))
       StackHorizontal(last, last.RGBAdjust(rb=64, gb=64, bb=64))
       StackHorizontal(last, last.RGBAdjust(rb=128, gb=128, bb=128))
    }
    
    
    function AnimateHS(clip v, int StartH, int EndH, int StartS, EndS)
    {
        black = BlankClip(v)
        hsmask = v.MaskHS(StartHue=StartH, EndHue=EndH, MinSat=StartS, MaxSat=EndS)
        Overlay(v, black, mask=hsmask)
        Subtitle("StartHue="+String(StartH)+"  EndHue="+String(EndH))
        Subtitle("StartSat="+String(StartS)+"  EndSat="+String(EndS), y=20)
    }
    
    
    GreyRamp()
    ConvertToYV24()
    YtoUV(last, TurnRight(last), ColorYUV(cont_y=-256))
    black = BlankClip(last)
    
    ah = Animate(0, 180, "AnimateHS", last,0,10,0,100,  last,350,360,0,100)
    as = Animate(0, 180, "AnimateHS", last,0,360,0,10, last,0,360,90,100)
    ab = Animate(0, 180, "AnimateHS", last,0,10,0,10, last,350,360,90,100)
    
    StackHorizontal(ah, as, ab)
    Image
    [Attachment 53592 - Click to enlarge]
    Quote Quote  
  21. Ok, whoah whoah slow down there my friend!

    I appreciate the knowledge but you throwing the entire library at me doesn't help! Easy!

    I'm asking these questions piece by piece because I know that folks here tend to go off in tangents like these. I'm not an expert at this nonsense in any way shape or form, so take it easy and use some knowledge lube on me, okay?
    Quote Quote  
  22. Goodness gracious, are you helping me or just showing off?
    Quote Quote  
  23. None of this is tangential to what you want to do. It's an attempt to help you understand what MaskHS is doing.
    Quote Quote  
  24. It's ok....in reality I'm just doing some noise filtering and only used the colors (in my initial post) to show where I was applying which denoiser. Thanks though, Mr. Brittanica
    Quote Quote  
  25. You don't need to understand how the script in post #50 works. Just look at what it does. Note how the masking changes as the numbers change.
    Quote Quote  
  26. I'll try it out.
    Last edited by Betelman; 29th May 2020 at 23:34.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!