|
-
Mar 17th, 2003, 09:54 PM
#1
Lively Member
Find one pixel that lies on the edge of the shape you want to trace around. This is your current pixel.
Look at the eight adjacent neighbors for a place where the color changes (in your case from red to white)
When looking for that point where the edge changes always start your next search where you left off in the last search.
That way things go fast for large straing edges
If that point is NOT the desired color then move counter-clockwise around the edge until it is.
If the point is the desired color move clockwise around the edge until it changes.
Select that edge pixel as your new current pixel. Repeat above until you get back to, or near, the first pixel.
Beacuse some shapes might be very large recording every pixel to map back onto a polygon can get quite tedious. To fix this, just save every 3rd or 5th pixel on the edge until you get back to the starting pixel.
You can also eliminate points by checking whether the 3rd pixel in a series of pixels lies on the same line as the previous two pixels. If so then delete the second pixel.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|