[lug] Off-topic: Contour line in image problem

Paul Bille Paul at ebille.cudenver.edu
Thu Dec 6 09:55:54 MST 2001


Nope!  Don't have the program written but it does seem pretty simple.

If I remember my calculus . . . the area of an arbitrary shape can be
calculated as sum ( y * dx ) as you traverse the perimeter of the
shape.  In the case of a pixel map, dx will be 1, 0 or -1 depending on
wether you're progressing from left to right, vertically or from right
to left in the pixel map.  You multiply the dx times the y coordinate
value, accumulate the result and you end up with the area in pixels.

Have fun,

Paul Bille http://bille.cudenver.edu/author
(303)979-0197





More information about the LUG mailing list