As the title states. I use mt_masks and would like to know if it's possible to do this. I'm currently working with animated content and have already figured out how to use mt_binarize, combined with levels in order to apply aggressive degraining to white/light pixels while masking out dark ones.
So, just like I was able to do this with light pixels, I was wondering if I can incorporate some color function into mt_binarize (or another mask function) in order to aggressively filter red pixels, while masking light/dark pixels. Here's what my current script looks like for filtering light pixels, but masking the others.
Code:mpg2sourece=(blah) a=last b=Mctemporaldenoise(settings="high", sharp=false, deblock=true, truemotion=true) mask = mt_binarize(threshold=65, Levels(20, 0.6, 255, 16, 235). Blur(1.5). FastLineDarkenMOD(). Toonlite(1.0). Toonlite(1.0). santiag(). santiag()) Overlay(a,b,mask=mask)
+ Reply to Thread
Results 1 to 30 of 56
-
-
In YUV by hue/saturation range - maskhs
http://avisynth.nl/index.php/MaskHS
In RGB , you can key out a color range to help create the mask with ColorKeyMask
http://avisynth.nl/index.php/Layer#ColorKeyMask -
I'm getting an error stating that "mask and overlay must have the same image size! (width is not the same)"
Here's my script:
a=last
b=blankclip(a, color=color_orange)
mask = MaskHS(startHue=075, endHue=115)
Overlay(a,b,mask=mask) -
maskhs works in YUV
Use ConvertToYV24() before maskhs, if your source is subsampled
You should view the mask first, and tweak the parameters to see if it covers what you want. You can adjust the parameters (e.g. you might want a high minsat value to exclude lower saturation "reds") . If the hue range is too "wide" you're going to include too many colors
(Sometimes, it's better to do some operations in RGB. For example, some types of complex keying work better in RGB . You might have to go to RGB and back to YUV in those cases) -
Ok, let's backtrack a bit: Nevermind the RGB one, I'm using MaskHS. But it's not working. What's wrong with my script?
-
a=last
b=blankclip(a, color=color_orange)
mask = MaskHS(startHue=075, endHue=115)
Overlay(a,b,mask=mask)
Try this
Code:a=last b=blankclip(a, color=color_orange) mask = a.ConvertToYV24().MaskHS(startHue=075, endHue=115) Overlay(a,b,mask=mask)
-
Ok, I see what you mean....I converted to YV24(). I'm testing it using the color yellow to see where my actual degrainer would be applied to, but it looks like a splotchy mess! Take a look. No red being filtered here that's for sure.
[Attachment 49786 - Click to enlarge] -
MaskHS is not very accurate in general. If your goal was the lips (only) , you probably need to soften and expand the mask . You also need to exclude the BG elements, possibly by increasing minsat and adjusting the hue range
RGB keyers (in composting software, such as after effects, nuke) are a lot more accurate for this type of mask/isolation work by color/hue -
Take a look at this one, I used levels from 0-200 and aaaah! she exploded into a yellow mess of post-flu mucus!
[Attachment 49787 - Click to enlarge] -
And why is it that every time I post an image, it comes out under your post as well as mine?
-
-
Don't bother with this approach, too many overlapping hues here if you wanted to isolate the hair
I assumed you wanted "red" , and I guessed "red lips" (I don't know what color the lips were, you never posted an original shot). But you actually wanted the orangey-red hair -
-
-
Wait a sec, look at this---I'm using starthue=50 and endhue=130 and I'm getting an improvement in coverage! (yes, I changed the color to green, but remember, this is just so I can see where my degrainer would go. I'm not trying to change any colors here). Ok, so can you show me a script where I can tweak this?
[Attachment 49788 - Click to enlarge] -
Just play with the parameters until you get something that you think is acceptable. Also play with minsat, maxsat
It's unlikely that you will get an accurate mask with this method of the hair only. It will include the necklace/beads, parts of the phone, nails, possibly the lips - because of the shared hues/colors -
You've mentioned her lips twice---you want to see her actual lips don't you? Oh you devil you!
-
You might be able to refine it by using other adding/subtracting other masks
For example, if "dark" background is unwanted, so might be able to exclude that by using a luma mask . But this also raises potential issues with dark lines
It's just that using that hue/saturation method alone isn't going to work well. It's like wearing a green shirt to a green screen shoot. -
-
Woohoo, look at me go!! This is actually pretty damn good. Thanks Poison!
[Attachment 49789 - Click to enlarge] -
There are those lips ! And they are.... pink
I hated her voice
Looks like slimer on her head. (Yes I know, the green is just visualizing the mask)
-
Hey! I didn't mean for you to see her lips!!! that was what I call a ...lip slip.
Ok, but don't go posting them all over the internet now. Keep it here!
Her lips are our secret. -
The last thing I would use for this would be AVISynth. It is a piece of cake to do in Vegas (Pro or the consumer version) using the "Secondary Color Corrector." Just click on the color you want to use as a mask, and then adjust the mask parameters (hue range, luminosity range, and saturation range) while watching the mask. You can then easily feather the mask, if you wish (probably not useful for anime). Once the mask is created, you can then modify the area you've selected in just about any way you can imagine.
AVISynth seems, to me, to be the wrong tool for this, although it is certainly an interesting discussion.
This is less than 30 seconds of work.
[Attachment 49790 - Click to enlarge]Last edited by johnmeyer; 13th Aug 2019 at 20:32. Reason: added image
Similar Threads
-
Avisynth mask to target plain colors?
By nMaib0 in forum Newbie / General discussionsReplies: 18Last Post: 23rd Apr 2018, 16:55 -
Encode for Target Size Fixed!!
By Cauptain in forum Video ConversionReplies: 13Last Post: 21st Oct 2016, 15:32 -
encode with X264 @ target size
By marcorocchini in forum Newbie / General discussionsReplies: 4Last Post: 2nd Sep 2016, 07:48 -
X264VFW encoding @ target size
By marcorocchini in forum Newbie / General discussionsReplies: 1Last Post: 11th Feb 2016, 19:34 -
VirtualDub, Xvid and target size
By lagartixa in forum Newbie / General discussionsReplies: 57Last Post: 8th Nov 2014, 07:11