Go to Post The best parts of FIRST just cannot be described. They have to be experienced. - sanddrag [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 27-11-2007, 08:28
tommy_chai tommy_chai is offline
Registered User
no team
 
Join Date: Oct 2007
Location: Msia
Posts: 12
tommy_chai is an unknown quantity at this point
How to filter the points to get only the left most and right most?

Hi all,
Kindly need your attention here.
Let say,
Code:
n = 0;  // number of corner points detected
if (......)
{
corner_list[n].x = j;  //x coordinate
corner_list[n].y = i;  //y coordinate
n++;
:
:
}
"m7.pgm"-->attached
This is the image and the marking at the contour are the detected points.
"m-004-1.pgm"-->attached
I want to get only the left most and right most points as corner. How can i write the codes to keep only these 2 corner points for every image?
From the left side, we can see there are two points with the same x-coordinate. From the right there are 3 or 4 points at the same x-coordinate.
How can we program to choose the most middle position for the left most and right most corner points?

Please help or give some ideas.
Thank you.

Best regards,
Attached Files
File Type: zip m7.zip (375 Bytes, 49 views)
File Type: zip m-004-1.zip (44.3 KB, 49 views)
  #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
  #3   Spotlight this post!  
Unread 28-11-2007, 11:39
tommy_chai tommy_chai is offline
Registered User
no team
 
Join Date: Oct 2007
Location: Msia
Posts: 12
tommy_chai is an unknown quantity at this point
Re: How to filter the points to get only the left most and right most?

The code from my previous post is to store the x and y coordinates which are detected into corner_list[n]. However, i need to filter it and save the left most and right most corner points, assume to be (x1,y1) and (x2,y2).

Can you show me how to get the correct x and y while there are two left most points with the same x-position? The height of my image is 80 pixels. So, if there is any left most or right most points with the same x-position, i will choose the one with y value nearest to 40 pixels. Can you show me how to program it and connected to my posted program?

Sorry I have just joined the world of programming. Any help will be appreciated. Thanks.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to filter the corners in image to get mouth corners only? tommy_chai Programming 3 20-11-2007 13:22
The Most Amazing Petition Ever Made In the Whole World coldabert Chit-Chat 5 14-02-2006 21:57
What is your most loved and most hated video games of all time? Elgin Clock Chit-Chat 64 25-10-2004 09:41
What is your most loved and most hated video games of all time? Elgin Clock IT / Communications 8 14-07-2004 18:31
Who had the most awesome robot at the nationals Don Taylor Championship Event 36 11-12-2002 21:51


All times are GMT -5. The time now is 06:09.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi