Automated Threshold & Edge Detection
It's a tiny bit late maybe, but here are two image processing techniques that deal with automated thresholding and edge detection that I showed in my "2d or not 2d" talk in 2007 and in "The Pixel Whisperer" in 2008. I've had a look at my presentation demos and repackaged their code into a single class called ThresholdBitmap. This is a BitmapData class with a few extras that help you if you plan to extract blobs or edges from a camera stream or some other bitmap. The general problem when you do camera based experiments is that you have unnown

A fix for createGradientBox()
Whilst playing around with some geometry that involved gradient fills I had to realize that the native implementation of Flash's createGradientBox() is unfortunately entirely useless as soon as you try to introduce rotation and scaling to a gradient. The reason seems to be that internally the order of matrix operations is unsuited for that task. Maybe I've searched not thoroughly enough, but I didn't find any solution for this out there. So I've written a tiny class that fixes it. Here's a comparison of the difference between matrix.createGradientBox() and my new GradientMatrix.getGradientBox() var fo = new FlashObject("http://www.quasimondo.com/examples/gradientMatrix/GradientBoxDemo.swf", "gradientBox", "500", "400",

Face Tracking Fun
I've started to have a bit of fun with the optimized Marilena face-tracking class and build a webcam based magic mirror. The specialty here is that it tries to displace your face only and leave the rest of the scenery untouched and additionaly adjusts the displacement scale based on how close you are to the camera: Check out Manic Mirror at the Incubator

Optimizing Flash Based Face Detection
Yesterday Seb-Lee Delisle pointed us via Twitter to this great example of a Flash based real-time face detection. It turns out that already more than half a year ago Ohtsuka Masakazu had been porting the face detection part of OpenCV to AS3 and added the source code to the Spark project - which is like a Actionscript candy box full of surprises. So I had a look at the source code and found one feature which I wanted to change: face detection is based on so-called Haar Cascades, simplified one could say that this is a very long list of

#tweetcoding Round 1 - a few more
Here are a few more of my entries for #tweetcoding: "Moskitos": g.clear();ls(1);o[i++]=[mouseX,mouseY,2*r(),2*r()]; for each(p in o){mt(p[0],p[1]); lt(p[0]+=2*s(p[1]*p[2]),p[1]+=2*s(p[0]*p[3])); };i%=2000 "Love in 3D": if(i "Hyperdrive": if (!o.b)addChild(o.c=new Bitmap(o.b=new BitmapData(500,500))),o.b.noise(2); z=s(i-=0.01)*15;o.c.z=-z;o.b.draw(this,o.o,o.o,"hardlight"); "Fibonacci Sequence": if(!i)i=1,o.b=0,o.c=addChild(new TextField),o.c.autoSize="left",o.c.wordWrap=o.c.multiline=1; o.c.appendText(" "+i),o.a=o.b,o.b=i,i+=o.a "All Invaders": if(!i) g.beginFill(0),a=b=i=64,d=511; g.drawRect(a&=d,b&=d,i,i); g.drawRect(d-a+1-i,b,i,i); a+=r() "The Golden Days": g.clear();g.beginFill(0); x=y=20;for(i=81;i--;g.drawCircle(40*a,40*b,d*2)) a=(i%9),b=int(i/9), d=m.sqrt((d=mouseX/40-a)*d+(d=mouseY/40-b)*d) "Superstar": g.beginFill(r()

#tweetcoding Round 1 - 1967 / Boids
Another two entries for #tweetcoding. "1967": i+=0.06;g.clear();g.beginFill(0);for(x=80;x--;){g.drawCircle(25+70*(x%9),25+70*(y=int(x/9)),70+(s(x%9*0.7+i+s(y*0.7+i)))*35)} var fo = new FlashObject("http://www.quasimondo.com/scrapyard/drawing1.swf", "tweetcode2", "500", "360", "10", "#e0e0e0"); fo.write("tweetcode2");

#tweetcoding Round 1 - Alien Vacation
Grant Skinner has started a litte competition on Twitter called tweetcoding where the goal is to create something nice in 140 chars of Actionscript 3. And the fine folks at Adobe actually will give a free copy of Flash CS4 to the winner, who will be picked on March 1st. As a starting point there is a small wrapper which predefines a few common functions and objects with short variable names. Above you see my first entry - which requires Flash Player 10 btw: which looks like this as a tweet

Getting the First Non-transparent Pixel in an Image
I just came across Sakri Rosenstrom's posts (1 2) about his methods of finding the first non-transparent pixel in a bitmap. Looks like he got inspired by my talk at MAX Europe - unfortunately he seems to have misunderstood my explanation back then. My bad - I should have posted my method a long time ago - so here we go. [Notice: it turns out that Sakri's method is faster than mine - please check the update at the bottom of this post] Here's a little demo. First you might ask what the hell this method is needed for at

New Stuff at the Incubator
In an attack of serious procrastination during the last days I've added a few new pieces to my Incubator: "Twittoscope" is a little Twitter mashup that analyzes the lengths of a Twitter user's tweets and generates a histogram from that - which can serve as a guide as to what kind of messages you can expect from that user in the long run. "Feedback" is a webcam experiment which started with a little Pixelbender feedback filter but grew into a kind of hypnotic visual toy that wants to be explored. In "Passing By" I have revisited my Anavision engine and

Shuffling Pixels
In my "Here be Pixels" talk one of the things I showed was how to use a combination of noise and the displacementMap filter to encrypt and decrypt images or data with Flash. In case you didn't see it, here's the principle behind it as a Peacock composition: The following post is about a related issue which uses a very similar technique, but I will also explain the encryption decryption method along the way. Imagine you want to visit every pixel in an image in random order but you do not want to visit any pixel more than once. Obviously

Game Of Life in 3 Lines of Code
Seeing Jop Wielens' implementation of Conway's Game of Life I wondered if I might be able to figure out a way how to run the whole game entirely with Flash's bitmapData methods. It turns out that it works, and it even works pretty fast. And at its core it just needs 3 lines of code: calculationMap.applyFilter( gameMap, rect, origin, neighbourBlur ); calculationMap.draw( gameMap, null, colorAdd, "add"); gameMap.paletteMap( calculationMap, rect, origin, zero, zero, rules ); Of course a few objects have to get initialized once, but then it's really just these 3 lines that do all the work. Here you go

Copy to Clipboard stopped working?
Here is a little info that could be interesting for all our Javascript and Ajax centered developers out there: as I just learned from our Aviary HTML guys there seems to be a pretty popular cross-browser compatible method out there that allows people to copy data to the clipboard by using a hidden Flash file to do the dirty work. The bad news is that this nifty method will stop working as soon as your users upgrade to Flash Player version 10. In the new version copying to the clipboard is only allowed upon direct user interaction, meaning a mouse

My FOTB 2008 Schedule
It's just a few days until THE Flash conference starts, so here is my schedule: Monday: 9:00 - Even though I'm a notorious keynote skipper this time I will check out Richard Galvan's Flash Now and in the Future sounds like a good way to get an overview over the latest developments. 10:15 - Stefan Richter with Building Collaborative Applications might have some ideas we could use for Aviary. 11:30 - Oh no - first conflict! I have make a decision between Branden Hall and Dr. Woohoo. I'm pretty sure Branden will have some great inspirations for coding or algorithms

Painting with LEGO™
Like parents that are excited when they see their brood grow its first teeth I'm getting a warm fuzzy feeling when I observe how people like mpeutz take my little baby Peacock further and further. In this video he builds virtual LEGO™ pieces from scratch (using the Terrain hub) and then assembles them with the help of the AutoPainter hub to take on the position and colors of a goldfish illustration. The nice thing is that once a composition is built you can simply exchange the picture with another one and it will immediately be rerendered - instant generative visuals

ActionScript Hero Interview
Recently I had the pleasure to get interviewed by Peter Elst - it looks like you can read my babblings on aSH now.