#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    surrey, uk
    Posts
    10
    Rep Power
    0

    Corner detectors


    Can anyone help with a corner detector in C? I'm trying to locate the corners in an image and the only methods I come up with are inaccurate if they work at all! Help
  2. #2
  3. Doggie
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2003
    Location
    Seattle, WA
    Posts
    751
    Rep Power
    13
    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.

IMN logo majestic logo threadwatch logo seochat tools logo