My question relates to finding contours in data and then ‘smoothing’ these contours. My input will simply be a grid of 4 bit quantities (0-15).

For example, consider the following grid of data:

(zero equals no data)

0 0 0 0 0 0 0 2 2 2 0 0

0 4 4 0 0 0 0 2 0 2 0 0

0 4 4 0 0 0 0 2 0 2 0 0

0 0 0 1 1 1 0 2 0 2 0 0

0 0 0 1 0 1 0 2 2 2 0 0

0 0 0 1 1 1 0 0 0 0 0 0

In the above example, there are obviously 3 rectangles. I’m in search of an algorithm that will identify the contours/boundaries of these rectangles and then a second algorithm to ‘smooth’ out the blocky corners.

My biggest concern at this point is smoothing the contour fields. I’ve found an algorithm to identify the contours in one of the graphics gems books (Graphics Gem III). I’ve considered using this algorithm in conjunction with some sort of bezier curve algorithm to smooth the corners.

Anyway, any links, books, suggestions you can provide will be appreciated.