12,076,925 members (46,360 online)
Rate this:
See more: , +
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

Top Experts
Last 24hrsThis month
 Sergey Alexandrovich Kryukov 354 Jochen Arndt 350 Richard MacCutchan 340 OriginalGriff 315 F-ES Sitecore 220
 OriginalGriff 2,855 Dave Kreskowiak 2,836 Richard MacCutchan 2,174 CPallini 1,632 Sergey Alexandrovich Kryukov 1,445