Page 1 of 1

Color replacement

PostPosted: Fri Apr 02, 2021 9:21 pm
by Jimmy Paez
I wonder how to replace the white strip on the T-shirt for the uploaded image and leave everything green?
vlcsnap-2021-04-02-16h12m58s983.png
vlcsnap-2021-04-02-16h12m58s983.png (981.95 KiB) Viewed 1102 times
Would you mind guys to share some tips on how to do it. Thanks.

Re: Color replacement

PostPosted: Fri Apr 02, 2021 11:40 pm
by Bryan Ray
The stripe and the helmet are the same color, so at at least a little bit of manual masking will be required. I'd start by using a BrightnessContrast tool to boost the saturation of the image in order to better separate the sky, shirt and stripe. Then a LumaKeyer to try to get the stripe separated from the shirt. A polygon tool to make a loose traveling matte around the stripe in order to separate it from the helmet and any other highlights. Multiply the polygon by the LumaKeyer with a ChannelBooleans, and use the result of that operation as a mask on whatever color correction is to be performed on the stripe.

Re: Color replacement

PostPosted: Sat Apr 03, 2021 12:52 am
by Jimmy Paez
Thank you Bryan, I'm really close to do it. I'm using a MatteControl node to expand de masking a little bit, but now I got a problem when I use the LumaKey mask for the BrightnessContrast node. How can I get rid of the black edge now?
Capture.PNG
Capture.PNG (834.05 KiB) Viewed 1018 times

Re: Color replacement

PostPosted: Sat Apr 03, 2021 1:29 am
by Bryan Ray
It's impossible to guess without knowing exactly what you're doing in that node. Chances are pretty good that you might have better luck plugging actual image into the BC node and using the LumaKeyer's output in the EffectMask (blue input). That way you won't be trying to Merge black pixels into your image along those edges.

But first try this for a potential slightly quicker fix: In the Merge, pull the Subtractive - Additive slider all the way to Subtractive.

Re: Color replacement

PostPosted: Sat Apr 03, 2021 1:51 am
by Jimmy Paez
My bad, here's the comp:

Code: Select all
{
   Tools = ordered() {
      AlphaMultiply1 = AlphaMultiply {
         ViewInfo = OperatorInfo { Pos = { 923.084, 124.524 } },
      },
      BrightnessContrast1 = BrightnessContrast {
         Inputs = {
            MultiplyByMask = Input { Value = 1, },
            Saturation = Input { Value = 0, },
            Low = Input { Value = 0.533, },
            High = Input { Value = 0.812, },
            Input = Input {
               SourceOp = "LumaKeyer1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 829.402, 19.2249 } },
      },
      MatteControl1 = MatteControl {
         Inputs = {
            Filter = Input { Value = FuID { "Fast Gaussian" }, },
            MatteBlur = Input { Value = 5.04, },
            MatteContractExpand = Input { Value = 0.21, },
            Background = Input {
               SourceOp = "LumaKeyer1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 646.097, -30.4932 } },
      },
      Background1 = Background {
         Inputs = {
            Width = Input { Value = 1080, },
            Height = Input { Value = 1350, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            TopLeftRed = Input { Value = 0.560784339904785, },
            TopLeftGreen = Input { Value = 0.635294139385223, },
            TopLeftBlue = Input { Value = 0.666666686534882, },
            EffectMask = Input {
               SourceOp = "MatteControl1",
               Source = "Output",
            }
         },
         ViewInfo = OperatorInfo { Pos = { 595.909, 119.337 } },
      },
      Merge2 = Merge {
         Inputs = {
            Blend = Input { Value = 0.512, },
            Background = Input {
               SourceOp = "Merge1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "BrightnessContrast1",
               Source = "Output",
            },
            ApplyMode = Input { Value = FuID { "Multiply" }, },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 808.976, 250.391 } },
      },
      Merge1 = Merge {
         Inputs = {
            Background = Input {
               SourceOp = "Loader1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "Background1",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 584.209, 248.023 } },
      },
      LumaKeyer1 = LumaKeyer {
         Inputs = {
            High = Input { Value = 0.667, },
            Low = Input { Value = 0.65, },
            Filter = Input { Value = FuID { "Fast Gaussian" }, },
            MatteContrast = Input { Value = -1, },
            ["Garbage.Matte"] = Input {
               SourceOp = "Polygon1",
               Source = "Mask",
            },
            Input = Input {
               SourceOp = "Loader1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 328.492, 97.5535 } },
      },
      Polygon1 = PolylineMask {
         DrawMode = "InsertAndModify",
         DrawMode2 = "InsertAndModify",
         Inputs = {
            Filter = Input { Value = FuID { "Fast Gaussian" }, },
            Invert = Input { Value = 1, },
            MaskWidth = Input { Value = 1920, },
            MaskHeight = Input { Value = 1080, },
            PixelAspect = Input { Value = { 1, 1 }, },
            ClippingMode = Input { Value = FuID { "None" }, },
            Polyline = Input {
               SourceOp = "Polygon1Polyline",
               Source = "Value",
            },
            Polyline2 = Input {
               Value = Polyline {
               },
               Disabled = true,
            },
         },
         ViewInfo = OperatorInfo { Pos = { 344.667, 20.2525 } },
      },
      Polygon1Polyline = BezierSpline {
         SplineColor = { Red = 173, Green = 255, Blue = 47 },
         NameSet = true,
         KeyFrames = {
            [0] = { 0, Flags = { Linear = true, LockedY = true }, Value = Polyline {
                  Closed = true,
                  Points = {
                     { Linear = true, X = -0.0881622495143316, Y = 0.228503182530403, LX = -0.0111172327767246, LY = -0.00902335345745087, RX = 0.0210872834552891, RY = 0.07404459019502 },
                     { Linear = true, X = -0.0249003991484642, Y = 0.450636953115463, LX = -0.0210872834552891, LY = -0.07404459019502, RX = -0.0156042494206315, RY = 0.00504245936490927 },
                     { Linear = true, X = -0.0717131495475769, Y = 0.465764343738556, LX = 0.0156042494206315, LY = -0.00504245936490927, RX = -0.00929614802597371, RY = -0.0026539319892851 },
                     { Linear = true, X = -0.0996015965938568, Y = 0.457802534103394, LX = 0.00929614802597371, LY = 0.0026539319892851, RX = -0.0245683921048366, RY = -0.0867834349346768 },
                     { Linear = true, X = -0.173306778073311, Y = 0.197452232241631, LX = 0.0245683921048366, LY = 0.0867834349346768, RX = 0.00830013452377295, RY = -0.00185775044997027 },
                     { Linear = true, X = -0.148406371474266, Y = 0.191878974437714, LX = -0.00830013452377295, LY = 0.00185775044997027, RX = 0.00896414241705283, RY = 0.00318471552713155 },
                     { Linear = true, X = -0.121513947844505, Y = 0.201433122158051, LX = -0.00896414241705283, LY = -0.00318471552713155, RX = 0.0111172327767246, RY = 0.00902335345745087 }
                  }
               } }
         }
      },
      Loader1 = Loader {
         Clips = {
            Clip {
               ID = "Clip1",
               Filename = "C:\\Users\\Jim\\Pictures\\vlcsnap-2021-04-02-16h12m58s983.png",
               FormatID = "PNGFormat",
               StartFrame = 983,
               LengthSetManually = true,
               TrimIn = 0,
               TrimOut = 0,
               ExtendFirst = 0,
               ExtendLast = 0,
               Loop = 0,
               AspectMode = 0,
               Depth = 0,
               TimeCode = 0,
               GlobalStart = 0,
               GlobalEnd = 0
            }
         },
         Inputs = {
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            ["Clip1.PNGFormat.PostMultiply"] = Input { Value = 1, },
         },
         ViewInfo = OperatorInfo { Pos = { 113.333, 97.6667 } },
      }
   }
}