Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Robot Image-Recognition , +
hi , at first i'm sorry for my bad english
 
I want to find the corners of the football field
And then I can use it to locate the robot in the field
I used the HoughLines() functions , but have not answered
 
Please, if you have a sample code about, put it to me
 
This is the code I used:
 

foreach (LineSegment2D l1 in lines)
{
    foreach (LineSegment2D l2 in lines)
    {
        if (Math.Abs(l1.P2.X) - Math.Abs( l1.P1.X) != 0 &&
            Math.Abs(l2.P2.X )- Math.Abs(l2.P1.X) != 0)
             
        {
            slope_l1 = Math.Abs(l1.P2.Y - l1.P1.Y) / Math.Abs(l1.P2.X - l1.P1.X);
            slope_l2 = Math.Abs(l2.P2.Y - l2.P1.Y) / Math.Abs(l2.P2.X - l2.P1.X);
 
            angle_l1 = Math.Atan(slope_l1) *180/  Math.PI;
            angle_l2 = Math.Atan(slope_l2) * 180/ Math.PI;
 
 
 
            if (
 
                Math.Abs(angle_l2 - angle_l1) > 80 && Math.Abs(angle_l2 - angle_l1) < 110))
                 
            {
               img.Draw(l1, new Bgr(Color.Yellow), 2);
            
 
            }
 
        }
    }
    this.Invoke(new Action(delegate()
    {
     
        pictureBox1.Image = img.Bitmap;
    }));
 
And If I change the condition to
 
if(   Math.Abs(angle_l2 - angle_l1) > 80 && Math.Abs(angle_l2 - angle_l1) < 110)
                              && ((l1.P1 == l2.P2)|| (l1.P2==l2.P1)
                              || (l1.P1==l2.P1) ||(l1.P2 == l2.P2) ))
 
There was no line display
 

plese help me
Posted 13-Oct-12 1:33am
Edited 13-Oct-12 1:35am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 13 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100