Archive for November, 2008

Webcam background removal in Flash

Thursday, November 27th, 2008

If you’re a fan of the EyeToy or you’ve just got You’re In the Movies on Xbox 360, you’ll know what this is all about. How to remove yourself from a web cam image and superimpose you on another background.

The mighty Jop had a bit of a testbed working and I thought I’d get the old brain working again and have a tinker. It’s not pretty code but it’s available below if you’re interested in a few pointers. It’s also not that good, but if it inspires you to do it better (I.e. properly) then it’s done its job.

If the web cam doesn’t initailise. Try this link:

In a nutshell:

1: Grab camera feed

2: Take a snap of the background

3: Use a ‘difference’ filter on them both to fighure out which pixels have changed the most

4: Use a ‘threshold’ filter to remove all the pixels that haven’t changed much

5: ColourTransform the resulting pixels to black

6: Apply a slight blur to help make it less jagged

7: Cache the resulting image as a bitmap (so it can be used as a mask) and put it over a copy of the live feed

8: Cache the live feed as a bitmap and apply the mask

9: And repeat using an interval or similar

Here’s the main function:

function takeSnapshot() {
//grab the cam and render it into a snapshot bitmapData obj
snapshot.draw(output_vid);
}

function checkVid() {
//grab live cam
liveData.draw(output_vid);
// grab snapshot
maskData.draw(snapshot);
// apply difference to 2 images
maskData.draw(liveData, new Matrix(), new ColorTransform(), ‘difference’);
// remove all unchanged pixels. Make them transparent
maskData.threshold(maskData, new Rectangle(0, 0, output_vid.width, output_vid.height), new Point(0, 0), “<=”, (threshVal/100)*0x00ffffff, 0×00000000, 0x00ffffff, true);
// colour what’s left black
maskData.draw(maskData, new Matrix(), new ColorTransform(0, 0, 0, 1, 0, 0, 0, 0))
// Blur to improve quality
maskData.applyFilter(maskData, maskData.rectangle, new Point(0, 0), blurFiltr);
resultData.draw(liveData);
// cache the resulting mask and apply it to the live feed
mask_mc.cacheAsBitmap = result_mc.cacheAsBitmap = true;
result_mc.setMask(mask_mc);

}

Source is here. Have fun!

Ads on pigeons

Tuesday, November 4th, 2008

I saw an interview with a perfectly mad aristocrat chap who thought pigeons where a bit dull, so employed someone to dye them bright colours. Turns out it’s an ancient and noble art practiced by the Spanish. Turns out there’s a company that dyes them for you for that all-important ‘mass release’ event you’re planning. See video on YouTube if you don’t believe me.

According to some, rather unofficial stats, there are roughly 400 million pigeons in the world, that’s 1 pigeon for every 16 humans alive, not a bad ratio. In the ever more segmented ad market, any new mechanism for reaching new consumers has got to be a winner. Especially in urban environments.

Anybody else thinking what I’m thinking?

The iPhone iPint and other cool ads…

Monday, November 3rd, 2008

If you manage to get your hands on the November edition of Revolution Magazine you may recognise the name on page 76! Well, you would if they spelt it right (it’s Dino Burbidge, not Dino Burbridge… story of my life).

I had the honour of writing the ‘Creative Review’ feature, where industry big-wigs pick campaigns and content that has caught their eye, or that caused a stir. I chose the ubiquitous iPint for the iPhone by Beattie McGuinness Bungay as my feature and also chose four others that I thought warranted some heat, both good and bad.

If you’re interested, click the page layout image below to get a bigger, almost readable sized version… or go and buy the magazine! :)