Hi All,
I'm setting up a repair for a clip damaged by lens blur (http://www.mediafire.com/file/0lym5r657vplaa7/Wide-angle_lens_blurring_sample.wmv). There's gradated centre-to-edge blur throughout, but there are also random "wash-outs" from luma flares which vary from frame to frame. This made a simple centre-to-edge gradated circular repair mask suboptimal, so I came up with this way of doing adaptive lens blur masking:
Results so far are very encouraging, but there are some issues I would very much appreciate your suggestions and guidance on.Code:# TODO: wrap in function and parameterise a = last # Remove grain before generating mask and sharpening a = a.TemporalDegrain (degrain=3, SAD2=400) # Create frame-adaptive mask # # TODO: evaluate other approaches (e.g. try to directly identify luma flares) # # Identify detailed vs flat areas (luma only) thY1 = 22 thY2 = 34 a.mt_edge(mode="hprewitt", thY1=thY1, thY2=thY2, y=3, u=-128, v=-128) # Consolidate detailed and flat areas medianblur(50,0,0) # Normalise mask levels to around full range to prevent sharp transitions around mask edges Levels(max(0, thY1-1), 1.000, min(255, (thY2+1)), 0, 255, coring=false) # Smoothen mask banding Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58) \ .Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58) ALBMask = Invert(channels="Y") # Create repaired clip # # TODO: complete evaluation of sharpeners strength = 1.0 # Purposely try to "repair" colour component too blr=gaussianblur(a,varY=128,varC=128,border=4,integrate=true,Y=3,U=3,V=3) mt_lutxy(blr,a,"y x - "+string(strength)+" * y +",y=3,u=3,v=3) # Normalise levels somewhat after including colour component above repaired = Tweak(hue=0.0, sat=0.7, bright=25.0, cont=0.8) # TODO: add motion compensation to temporally smooth repair artifacts # TODO: add optional soft sharpening of original (doesn't add value with current footage) mt_merge (a, repaired, ALBMask, luma=false, y=3, u=3, v=3)
1. The two blurring steps above are quite crude - are there better ways of doing those?
2. Using edge detection to infer blur leads to over-repairing of areas that really don't contain detail. Fortunately this clip has enough detail and doesn't have that problem, but in principle the following alternative to identifying luma flares sounds possible:
Does it sound possible to do this in a script? If so, in principle, which tools would you suggest for the various steps?Code:Create a rough mask, e.g. with edge detection as above Within that mask area, look for the characteristics of these luma flares:areas of above-threshold luma with above-threshold contrast to adjacent areasUse the edge detection mask for general sharpening as above (perhaps a bit weaker) Repair areas within the luma flare mask more aggressively:perhaps topological reconstruction and stronger sharpening, normalising their luma and contrast closer to adjacent areas etc. Or perhaps even try to replace pixels with unaffected ones from other frames.
3. Do you know of existing frame-adaptive masking scripts I can look at? Especially ones that look for luma flares?
4. Ditto for scripts that look for healthy replacement pixels in other frames and intelligently handle cases where not all affected pixels could be replaced?
5. Am I going the right direction, barking up the wrong tree, anything else?
Many thanks in advance,
Francois
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 1 of 1
Thread
-
Last edited by fvisagie; 12th Nov 2012 at 06:53. Reason: Fixed .blur().blur()... copy and paste
Similar Threads
-
Adaptive Quantization
By donkeykong in forum Newbie / General discussionsReplies: 1Last Post: 5th Oct 2011, 07:23 -
Adaptive bit rate flash media servers
By jbandy1 in forum Video Streaming DownloadingReplies: 5Last Post: 22nd Jun 2011, 21:52 -
Masking without re-encoding
By rds11 in forum EditingReplies: 1Last Post: 21st Jul 2010, 07:56 -
Nero Vision (edit:) Motion Adaptive Frame Rate Conversion
By sagat93 in forum Authoring (DVD)Replies: 12Last Post: 3rd Mar 2010, 11:06 -
Procoder PAL adaptive interlace vs virtualdub
By telefunken in forum Video ConversionReplies: 1Last Post: 6th Mar 2009, 03:36