View Single Post
  #2   Spotlight this post!  
Unread 27-11-2007, 15:55
mluckham's Avatar
mluckham mluckham is offline
Registered User
FRC #0758 (Sky Robotics)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Ontario, Canada
Posts: 116
mluckham will become famous soon enoughmluckham will become famous soon enough
Re: How to filter the points to get only the left most and right most?

I'm not sure of your data, it looks like a series of X, Y, VALUE triples.

How about something like this ...


upperleft_y = first value of Y
upperleft_x = first value of X
lowerright_y = first value of Y
lowerright_x = first value of X

As you iterate through the remaining points X,Y,VALUE in your data:

if (X < upperleft_x) AND (Y < upperleft_y)
upperleft_x = X;
upperleft_y = Y;

if (X > lowerright_x) AND (Y > lowerright_y)
lowerright_x = X;
lowerright_y = Y;


If each line of your .PGM represents one image, then repeat the above for each line and store the resulting upperleft and lowerright X,Y pairs in your corners[] array.

mike