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