Demo #1
Try: Travelling In EgyptSource: Pyramid.as
An webcam is needed to try this. Blue background screen is not needed. At first, hide out from the camera for LiveChromaKey to recognize the background view. After few seconds, the pyramid of Khafre will be shown. It's time to play it! Now you can feel free you are travelling in Egypt. :)
In case you move camera, click the screen to re-recognize background on demand. Then hide out and wait for few seconds again. You may need to turn off your camera's intelligent features like automatic white balance, automatic exposure compensation, etc. LiveChromaKey does not like such tunings.
Demo #2
Try: Minority Report-like DemoSource: Minority.as
This demo floats some photos in your back. Finger pointing reorganization like the Minority Report movie is not implemented at this time.
Demo #3
Try: Four Sprites Of LiveChromaKeySource: Panels.as
This demo shows the four sprites which LiveChromaKey provides.
LiveChromaKey Sample Code
var chromakey:LCK_Core = new LCK_Core();
chromakey.init();
var spLive:Sprite = chromakey.getLive();
var spBack:Sprite = chromakey.getBackground();
var spMask:Sprite = chromakey.getMask();
var spFore:Sprite = chromakey.getForeground();
this.addChild( spLive );
this.addChild( spBack );
this.addChild( spMask );
this.addChild( spFore );
The getLive() method returns a sprite which shows the live video. You can use it as a background for your app.
The getBackground() method returns a sprite which shows the stationary background image. You can use it as a background for your app as well.
The getMask() method returns a transparent sprite which shows the blue mask image. You may not use it normally.
The getForeground() method returns a transparent sprite which shows the dynamic foreground image. It would contain a person or objects in front of camera. You can use it as a foreground for your app.
LiveChromaKey Properties
Set properties below before call init() method.chromakey.captureX = 320;Web camera input source's resolution and frame rate
chromakey.captureY = 240;
chromakey.captureFPS = 30;
chromakey.displayX = 640;Output sprites' resolution and smoothing.
chromakey.displayY = 480;
chromakey.smoothing = false;
chromakey.workX = 80;Working resolution by pixel.
chromakey.workY = 60;
The following method and property is for after it started.
chromakey.runDetector()Method to re-recognize stationary background.
chromakey.readyBoolean value for stationary background is detected.
How To Compile It
Download LiveChromaKey source code from the Spark project.svn co http://www.libspark.org/svn/as3/LiveChromaKey/trunk/ livechromakey
* Original posts for demo #1, demo #2 and demo #3 are written in Japanese.