Hello. I am prefiltering animated content with McTemporalDenoise, but I only want to denoise light pixels, and mask dark ones. Now, I've tried using a binarize mask (mt_binarize) which works okay, but leads to other issues in my final result (as I am doing a second pass with Smdegrain to tackle the dark pixels, since it treats them much better).
However, after reading further into the MCTemporalDenoise functions, I discovered that there is a function called "bias", which allows you accomplish the masking task with dark/light pixels.
But I'd like to actually see what I'm masking/filtering. I'd like to run a test script using a color so that I can see this. Can someone offer such a script?
However, I also know that Mc uses MVTools, so I don't even know if I can accomplish what I'm trying to with just Mc
Thanks.
		
			+ Reply to Thread
			
		
		
		
			
	
	
				Results 1 to 6 of 6
			
		- 
	
- 
	I don't really know what the bias function does but it is very subtle. If you really want to control the denoising by brightness build you own mask and overlay the denoised video over the original video via the mask. 
 
 For example,
 
 Will build a mask based on the Y channel. Y values below min become 0, Y values above max become 255, Y values in between are proportionally spaced between those extremes. For example, a greyscale ramp:Code:function YMask(clip v, int min, int max) { Levels(v, min, 1, max, 0, 255, coring=false).GreyScale() }
 
 
 [Attachment 49727 - Click to enlarge]
 
 after YMask(min=100, max=156)
 
 becomes:
 
 
 [Attachment 49728 - Click to enlarge]
 
 Now you know how to build a mask based on intensity.
 
 When you use a mask with Overlay() the pixels where the mask is black are taken from the first video, the pixels where the mask is white are taken from the second video. The pixels where the mask is in between are a weighted average of the two videos.
 
 If you want to easily see the differences Interleave() the original and the new image. Add to the end of the script:Code:original = WhateverSource(...) mymask = original.YMask(100,156) # adjust to suit your video denoised = original.MCTemporalDenoise() Overlay(original, denoise, mask=mymask) 
 
 Then flip back and forth between frames in an editor (left, right arrows in VirtualDub, for example). If you want a more obvious hint add the mask to the interleave:Code:Interleave(original, last) 
 
 Code:Interleave(original, last, mymask) 
- 
	Interesting, thanks Jagabo. After some trial and error, I settled for mt_binary, which masks out the black pixels (part of what I wish to achieve), while allowing me to filter other colors and gradients. In order to adjust, I'm using ColorYUV(gain_y=, off_y=, cont_y=). As I play around with it, I'm finding it much easier to manipulate what I want to filter, and what I want to leave alone. 
 
 So my script looks something like this:
 
 Now here's my question: My video is a YV12() source, so I'm wondering if temporarily converting it to RGB32 and, instead of adjusting my masks using ColorYUV, I can do a much better job with AdjustRGBLevels().Code:MPEG2Source("blah") a=last b=blankclip(a, color=color_orange) ##color for testing only so that I can see what will be masked and what will be filtered mask = mt_binarize(threshold=70, ColorYUV(gain_y=50, off_y=-40, cont_y=30). Blur(1.5). toon(). Fastlinedarkenmod(). toon(). toon(). toon(). Santiag()) Overlay(a,b,mask=mask)
 
 Then when I'm done, I can convert back to YV12.
 
 Will it make a difference?
- 
	Also of course, if you see any adjustments I can make here, please let me know. 
 
 Thanks.
- 
	YMask() returns the same mask as mt_binarize() if you set min and max to the same threshold as mt_binarize(). So YMask(min=70, max=70) returns the same mask as mt_binarize(threshold=70). Though YMask() also forces the output to greyscale. I usually prefer to use softer edges so that you don't get an obvious demarcation where the mask stops. For example a yellow ramp: 
 
 
 [Attachment 49768 - Click to enlarge]
 
 mask = YMask(120,120)
 Overlay(last, Tweak(hue=10), mask=mask)
 
 [Attachment 49769 - Click to enlarge]
 
 mask = YMask(100,140)
 Overlay(last, Tweak(hue=10), mask=mask)
 
 [Attachment 49770 - Click to enlarge]
 
 Yes, some color adjustments can only be made (or are much more easily made) in RGB. So sometimes you cannot avoid converting to RGB. You will get a little blurring of colors with a round trip from YV12 to RGB to YV12.
 
 Be sure your levels are correct before the conversion so you don't lose superblacks and superwhites.
Similar Threads
- 
  Annotation function instead of YoutubeBy omaruko in forum EditingReplies: 0Last Post: 19th Oct 2017, 08:55
- 
  Avisynth Loop functionBy pooksahib in forum Video ConversionReplies: 16Last Post: 29th May 2016, 13:03
- 
  Function F2 not workingBy jyeh74 in forum ComputerReplies: 9Last Post: 22nd May 2016, 19:15
- 
  Lid close functionBy mlmiller707 in forum ComputerReplies: 4Last Post: 20th Nov 2015, 19:53
- 
  Resume functionBy sm789 in forum Newbie / General discussionsReplies: 4Last Post: 22nd Feb 2015, 14:49


 
		
		 View Profile
				View Profile
			 View Forum Posts
				View Forum Posts
			 Private Message
				Private Message
			 
 
			
			 
			
 Quote
 Quote