VideoHelp Forum
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    I've got a video that is not bad except for white dust specks.
    Colour, 464x352.

    I'd like to remove all the 2x2 or smaller white spots that last just one frame.
    E.g., as image, top right.


    I tried the RemoveDirt() AVSI, but while it gets rid of the spots it destroys too much detail. Even extreme sharpening after can't restore the original detail.
    It's very good if you have a crappy source, but is overkill for this.

    Is there a different filter that is more specific or does less collateral damage?
    Or a tweak to RemoveDirt -- the "repmode" perhaps? This doesn't seem to be documented though.
    Image Attached Thumbnails Click image for larger version

Name:	spot.png
Views:	653
Size:	124.4 KB
ID:	21572  

    Last edited by AlanHK; 4th Dec 2013 at 01:28.
    Quote Quote  
  2. RemoveSpots, or RemoveSpotsMC?
    Quote Quote  
  3. And you could use a mask based on the luma so that only the brightest areas are treated.

    Code:
    AviSource("spot0.avi") 
    ConvertToYV12()
    src=last
    
    lmask = mt_binarize(150).mt_expand().mt_expand().Blur(1.0) # build a mask based on luma
    Overlay(last, RemoveSpotsMC(), mask=lmask) # only apply RemoveSpotsMC() to bright areas
    StackHorizontal(src, last) # show before and after, side by side
    AssumeFPS(3) #slow so we can clearly see it
    Image Attached Files
    Last edited by jagabo; 5th Dec 2013 at 09:16.
    Quote Quote  
  4. That's pretty cool. Can you explain how only bright spots are treated? Is that what the 'mt_binarize(150)' does? It calls RemoveSpotsMC to be used only in areas where the luma is greater than 150?

    To sidetrack this a bit, I'm much more likely to have dark spots needing removing. How would you adapt the script to use RemoveSpotsMC only in areas below ... say ... 50?
    Last edited by manono; 5th Dec 2013 at 15:07.
    Quote Quote  
  5. Originally Posted by manono View Post
    That's pretty cool. Can you explain how only bright spots are treated? Is that what the 'mt_binarize(150)' does? It calls ReplaceFramesMC to be used only in areas where the luma is greater than 150?

    To sidetrack this a bit, I'm much more likely to have dark spots needing removing. How would you adapt the script to use ReplaceFramesMC only in areas below ... say ... 50?

    Do you mean RemoveSpotsMC ? Because ReplaceFramesMC() wouldn't work so well with a luma mask in general because the timing of the replacement overlay wouldn't match the baseclip

    There is a lumamask() function that you can set black and white points with b=, w=

    But mt_binarize creates a binary mask ("binary" as in on/off or white/black) . If you use mt_binarize(50) , the cutoff will be 50, but 0-50 will be black, 51-255 will be white. Use upper=true to "invert" the mask (so 0-50 is white, 51-255 is black)

    Often you don't want such a "harsh" or "abrupt" cutoff for the transitions for the mask overlay , ie . you want to "feather" the mask, so the overlay "blends" in . That's what jagabo is doing by expanding the mask and blurring it; as usual there are many approaches . You can "view" the mask by returning "mymask" in the example below. Of course replace somefilter() with your intended filters

    eg

    Code:
    orig=whateversource()
    
    orig
    mt_binarize(50, upper=true)
    mymask=last
    
    orig
    somefilter()
    filtered=last
    
    overlay(orig, filtered, mask=mymask)
    #mt_merge(orig, filtered, mymask, luma=true)
    I was discussing with gavino , and mt_merge() is preferred to overlay() in the strict YV12 case, because it's faster and uses less memory (overlay has more uses when using other colorspaces, or using various layer blend mode operations)
    Last edited by poisondeathray; 5th Dec 2013 at 14:48.
    Quote Quote  
  6. Damn, I read and reread it before posting but still... Yes, I meant to say RemoveSpotsMC. I'll fix it above.

    Ah, Upper=true does it. No matter how good the RemoveSpotsMC, it can't help but soften the picture a bit and this sort of thing can lessen the 'damage' outside of the areas being filtered. Thanks a lot to you both.
    Quote Quote  
  7. AlanHK makes sure to take extra care of his chocolate
    Quote Quote  



Similar Threads

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