
August 6th, 2003, 02:47 PM
|
 |
Doggie
|
|
Join Date: Jul 2003
Location: Seattle, WA
Posts: 751
  
Time spent in forums: 10 h 38 m 25 sec
Reputation Power: 7
|
|
Are you looking for the bounding box of an image? Here's the basics:
Scan each horizontal line in the image for a color that's not the background starting with the top line. When you find a different pixel color, that's the top of your bounding box.
Code:
found=false;
for y=1 to imageheight||found{
for x=1 to imagewidth||found{
if (pixel(x,y) != background color){
box.top=y;
found=true;
}}}
Do the same, but starting from the bottom of the image to find the bottom of your bounding box.
Same process again for the sides, but search the vertical lines starting from left and right sides.
|