Skip navigation
This discussion is archived

Simple key by subtracting the background

1745 Views 9 Replies Latest reply: Aug 23, 2011 2:05 PM by MacP1 RSS
MacP1 Calculating status...
Currently Being Moderated
Aug 18, 2011 1:50 PM



I will be very grateful for any help. I want to create a simple key similar to that used in Ichat i.e. the background is removed by taking an image/short sequence of the background then subtracting that background from the talent filmed afterwards. Keying with a blue or green screen etc is not a problem. However, a simple/low end key with almost any background is what I am looking to achieve but don't know if this is possible in Shake. I expect that the camera will have to be perfectly still so that the image of the background is exactly the same with and without the talent.


All help appreciated!

  • Ralph Johns (UK) Level 9 Level 9 (66,840 points)
    Currently Being Moderated
    Aug 19, 2011 2:50 PM (in response to MacP1)



    The Backdrop effects in iChat (And Photo Booth) are created with Quartz Files.


    If you use the Install Disk > Optional Installs folder > XCode you will get Delevopers Tools.
    Quartz Composer is installed as part of this process.


    The .qtz files can then be opened in Quartz Composer and you can explore haow they are put together
    They are stored in Hard Drive/System/Library/Compositions.


    How you might use these in other apps is beyonfd my knowledge.


    (I was checking on posts with "iChat" in them)





    10:50 PM      Friday; August 19, 2011

    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"


     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb( 10.6.8)
     Mac OS X (10.6.8),

    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • BenB Level 5 Level 5 (7,545 points)
    Currently Being Moderated
    Aug 21, 2011 5:02 AM (in response to MacP1)

    Phyx Keyer, comes with Plate abilities.  Using Plates is old hat in film.  Much easier in digital video now.  Simply shoot the scene without actors.  Shoot again with actors.  Phyx Keyer will allow you to apply the Plate, which keys out the actors from the background.  Very easy, very fast, works in FCP legacy, FCP X, Motion 5, and AE.  Was originally a Shake plugin.

  • stuckfootage Level 4 Level 4 (3,040 points)
    Currently Being Moderated
    Aug 21, 2011 1:12 PM (in response to MacP1)

    MacP1 wrote:

    Still hoping there may be a way in Shake

    To create a difference matte in Shake, use an ISubA followed by a LumaKey. Then you can take the output the LumaKey as your matte, and use a KeyMix for the composite.


    Difference mattes are notoriously ineffective. Look at your alpha channel in the LumaKey. All the little white spots in the otherwise black background area are places where the camera or background moved, or the result of noise. All the little black spots in the otherwise white foreground area are places where the foreground image pixels just happen to be the same as the background.


    You can improve the result somewhat by making LumaKey's hiVal and loVal very close to each other, and by following LumaKey with a DilateErode.


    You could probably improve your results by careful lighting, too, especially using enough light to minimize noise.


    Then there's always RotoShape.

  • stuckfootage Level 4 Level 4 (3,040 points)
    Currently Being Moderated
    Aug 22, 2011 1:38 PM (in response to MacP1)

    MacP1 wrote:

    If you have an example of the node tree that would be brilliant.


    I've pasted an example script below. For some reason, this forum software adds carriage returns to the RotoShape data, which ruins it. So paste the script into Shake, then create a little triangle in the middle of the RotoShape. That triangle is your actor.


    First of all, I've created two fake images (one with a triangle on grey background and one with just the grey backgorund). Then I've added film grain to simulate the real world (you probably have video noise, but the effect is the same). So the outputs of the two film grain nodes represent your original footage. Important note: the two film grain nodes use a different seed value. Otherwise, they would be identical. In the real world noise is different for each frame. This is important.


    Just to be clear, you will substitute your two FileIn nodes for the whole Rotoshape/Color/Max/FilmGrain section.


    Now for the difference matte. As mentioned in my previous post, you use ISubA to subtract the two images, followed by a LumaKey to actually create a matte. Look at the alpha channel of the LumaKey and try to adjust the loVal and hiVal to get a good key. You'll see how the noise (film grain) is a big problem.


    Finally, I use the LumaKey to composite the foreground image against a lovely orange background. You'll see that it does work, but it's not perfect. That's a difference matte example.







    Color1 = Color(1280, 720, 1, 0.4, 0.4, 0.4, 1, 0);

    Color2 = Color(1280, 720, 1, 1, 0.5, 0, 1, 0);

    RotoShape1 = RotoShape(1280, 720, 1, "v4.10", 0, 0, 0, 1, 1,

        xScale, width/2, height/2, 0, 0.5, 0, 384, "100W@0B000VDhsuH9RYbMXJCo8QUPcJkW66fOX2cOZe2cwdLnSH198Q8CsQa9SO3XAO6mQgLH1KZ26 15W18QecceNcffdG6a#5bNc#zbl9EAcRHM#vaVpfvqKHf6fbgf26edf2efWcX1v98Qe1seZfd0f6DfqB sHThwmDdkXf2KGDeUpTHGdCSzfbk3xAJQSsbacHsjYGtn6w0dGHSP9PDme2ma5MC0YWR8ZEK98nCZ34V mOYRkm5xB0WY7RW1642q026CmW3EOenBEqmGpTSUGs0W0bM#1IEbIXSpl0lism3i19FIkOvO03s900IG mSY19dB000000000018");

    FilmGrain2 = FilmGrain(Color1, "v3.0", 2, 1, 1, 2, "Eastman 5245",

        0.031722, 0.020731, 0.047893, 1.14428, 0.993067, 0.997656,

        0, 0, 0, 0.091092, 2.671764, 2.903616, 3.183743);

    Max1 = Max(RotoShape1, Color1, 1, 100);

    FilmGrain1 = FilmGrain(Max1, "v3.0", 2, 1, 1, time, "Eastman 5245",

        0.031722, 0.020731, 0.047893, 1.14428, 0.993067, 0.997656,

        0, 0, 0, 0.091092, 2.671764, 2.903616, 3.183743);

    ISubA1 = ISubA(FilmGrain1, FilmGrain2, 1, 100);

    LumaKey1 = LumaKey(ISubA1, 0.2, 0.3, 0, 0, 0);

    KeyMix1 = KeyMix(Color2, FilmGrain1, LumaKey1, 1, "A", 100, 0);

  • Patrick Sheffield Level 7 Level 7 (29,175 points)
    Currently Being Moderated
    Aug 23, 2011 1:34 PM (in response to MacP1)

    Generally to create a Difference Matte in Shake,  I use the "Common" node - this can be set to produce black where things are the same and white where they differ. To do any kind of difference matte, you need a clean plate so you can have something to be different from (why in iChat they make you step out of the frame).


    Use this Search to find other posts with this technique.


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.