Tag Archive for 'edges'

Canny Edge Detector [AS3 + PixelBender]

Canny Edge Detector

The Canny edge detection operator was developed by John F. Canny in 1986 and uses a multi-stage algorithm to detect a wide range of edges in images.
While researching motion tracking questions I’ve faced Canny Detector and thought it would be great to run it in Flash. My first approach was to code it in pure AS3, ofcourse I failed. It uses lots of computations in 2D loops so Flash version was running at 12 FPS from 33 required. That time Mario Klingemann released his files from old presentation about image processing and BitmapData thresholding in general. I’ve noticed it was using PixelBender to threshold BitmapData objects. That was an idea!
I’ve never used pixelbender before so it was a little pain to learn whats going on there, also no traces available is terrible. It’s a long story to tell ya ;) finally we have 6 pixelbender filters and one flash class to handle detection. It runs pretty fast but I guess someone can do it even faster cause it was my first try and I dont know all bender possibilities.

See demo application (you will need web camera and Flash 10 installed)
Sources can be accessed in my Google repo
And here is some demo videos from developing timeline and more screenshots:
First version in pure AS3
First attemp in pixelbender

Canny Edge Detector
Canny Edge Detector
Canny Edge Detector
Canny Edge Detector