Tuesday, May 27, 2008

Real Time Edge Detection in Flash









Over the last few weeks I've been working on some image processing in Flash. Heres the first post in what could be a series.

The program above shows 3 types of edge detection:

They vary in complexity, the basic sobel algorithm takes advantage of ActionScript 3's built in convolution filter and bitmapdata thresholding function (its not a true sobel edge but close).

The next option combines the two Sobel edges more precisely to create a Gradient Magnitude image. Each pixel is iterated over to combined using their absolute values.

For a tutorial of how to create the gradient magnitude image see this more recent post.

For non-maixima suppression I had to use the ByteArray Object to manipulate the image data. I've made a new implementation which is about 5x faster without need for ByteArrays. The frame rate slows by about 20% when compared with Sobel.

Non-maxima suppression creates 1 pixel thick edges very useful for other types of image processing (such as the Hough transform to find circles).

The code for the last two is based on an excellent tutorial on image processing here.

Thanks for reading.

Labels: ,

4 Comments:

Anonymous LAJ said...

Awesome work!

4:30 PM  
Anonymous craighellen said...

looking good, i never felt so zombified,

6:49 PM  
Anonymous sandro said...

good job!
can you post the source code and the .fla?

5:18 PM  
Blogger SeyelentEco said...

Hey Luke,
You posted in the kirupa forum that my code inspired you... well your code has now inspired me to try to get the NMS implementation to work.

However, I haven't been able to get it to work as performant as yours or as clean (the edges on mine aren't as singular).

Mind sending me your source for the NMS stuff?

Thanks,
Alex
alex.petrescu@gmail.com

4:50 PM  

Post a Comment

<< Home