VideoHelp Forum
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. Hi c*a*t*s

    please I wonder if exist a plugin for avisynth that correct white balance @ a desiderd value (for example: bring me from 3.200 to 6.300K)
    and/or a sort of continuouns white balance function

    Thanks
    Quote Quote  
  2. A couple of years ago I posted a script that adjusts color temp separately for lowlights, midrange and highlights.

    Over-adjusted to show the range of the effect. Normally you would use this filter to fix bad white/black/overall color balance.
    Click image for larger version

Name:	CheapColorTemp-demo92.jpg
Views:	348
Size:	116.3 KB
ID:	38984

    Code:
    #######################################
    ### emulate color temperature changes in three luma ranges
    ##
    ## @ offset_x - arbitrary units; <0 means lower temp (warmer colors)
    ##     (input range is unlimited, but is normally around -20 to +20; default 0)
    ##
    function CheapColorTemp(clip C, 
    \            int offset_lo, int offset_mid, int offset_hi)
    {
        Assert(C.IsYUV, "CheapColorTemp: source must be YUV")
    
        return C.ColorYUVx3(
        \          off_u_lo =offset_lo,  off_v_lo =Round(-0.7*offset_lo),
        \          off_u_mid=offset_mid, off_v_mid=Round(-0.7*offset_mid),
        \          off_u_hi =offset_hi,  off_v_hi =Round(-0.7*offset_hi))
    }
    
    #Requires Masktools
    # https://github.com/tp7/masktools/releases
    #######################################
    ### apply ColorYUV U & V offsets to three luma ranges
    ##
    ## @ off_x   - see ColorYUV
    ## @ xover_x - aproximate 50% luma blend between ranges
    ##     ( no reason to mess with this)
    ## @ showmasks - if true, show original + 3 masks in quad split
    ##
    function ColorYUVx3(clip C,
    \           float "off_u_lo", float "off_u_mid", float "off_u_hi",   
    \           float "off_v_lo", float "off_v_mid", float "off_v_hi",
    \           float "xover_lomid", float "xover_midhi",
    \           bool "showmasks")
    {
        off_u_lo  = Float(Default(off_u_lo,  0.0))
        off_u_mid = Float(Default(off_u_mid, 0.0))
        off_u_hi  = Float(Default(off_u_hi,  0.0))
        off_v_lo  = Float(Default(off_v_lo,  0.0))
        off_v_mid = Float(Default(off_v_mid, 0.0))
        off_v_hi  = Float(Default(off_v_hi,  0.0))
        xlo = Min(Max(  0, Default(xover_lomid, 102)), 127) * 3.0 / 256
        xhi = Min(Max(128, Default(xover_midhi, 191)), 255) * 3.0 / 256
        showmasks = Default(showmasks, false)
    
        C_lo  = C.ColorYUV(off_u=off_u_lo,  off_v=off_v_lo)
        C_mid = C.ColorYUV(off_u=off_u_mid, off_v=off_v_mid)
        C_hi  = C.ColorYUV(off_u=off_u_hi,  off_v=off_v_hi)
    
        ## mt_lutxyz too slow!!
    
        mask_lo  = C.mt_lut(
        \   yexpr="x -0.01 * "+String(xlo)+" + 256 * ",
        \   u=-128, v=-128)
        
        mask_hi  = C.mt_lut(
        \   yexpr="1 x -0.01 * "+String(xhi)+" + - 256 * ",
        \   u=-128, v=-128)
        
        mask_mid = mt_lutxy(mask_lo, mask_hi, "x  y + -1 * 256 + ", u=-128, v=-128)
        
        return (showmasks)
        \  ? StackVertical(
        \       StackHorizontal(C, mask_lo),
        \       StackHorizontal(mask_mid, mask_hi))
        \       .BilinearResize(C.Width, C.height)
        \       .Subtitle("Low",    align=9)
        \       .Subtitle("\nMid",  align=4, lsp=0)
        \       .Subtitle("\nHigh", align=6, lsp=0)
        \  : C.Overlay(C_lo,  mask=mask_lo)
        \       .Overlay(C_mid, mask=mask_mid)
        \       .Overlay(C_hi,  mask=mask_hi)
    }
    Last edited by raffriff42; 21st Oct 2016 at 17:17. Reason: changed sample image
    Quote Quote  
  3. You might want to take a look at this white balance function:

    GamMac

    Scroll down the first page to see some examples of what it can do.
    Quote Quote  



Similar Threads

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