Home ContactTwitterFlickr

[June 18, 2009]

Marching Squares: Boundary detection

Filed under: ActionScript — @ 6:30 pm — Tags: ,

A little code for a change.

Sakri was working on this, and I ported a class from Java which I believe he adapted into his final implementation. It’s a basic tool for morphing, 3D surface reconstruction, and vectorization.

I’ve cleaned up my version of it and I offer it here. The important function signature looks like this:

public static function perimeter(data:BitmapData, x:int, y:int):Vector.<Point>

It returns a list of pixels representing the boundary between opaque and transparent pixels, starting from a single boundary point that you provide.

You can get a boundary point using Sakri’s and Mario’s EdgeFinder class.

Download the source.

How it works: Marching Squares on Wikipedia

2 Comments »

  1. I guess your one is ported from this:
    http://www.tomgibara.com/computer-vision/marching-squares

    Comment by Eugene — June 29, 2009 @ 4:04 am

  2. Correct, Eugene.

    Comment by alan — June 29, 2009 @ 7:39 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

Get Your Own Real Time Visitor Map!

Entire contents copyright © Alan Shaw 2005-2009. All rights reserved. You may not reprint or repost the contents of this site without the express written permission of the author.

31 queries. 0.438 seconds. Powered by WordPress version 2.8.4

Bad Behavior has blocked 568 access attempts in the last 7 days.