i need help to find intersection point of 2 lines in image

payam1363

Member
Joined
Jun 23, 2021
Messages
7
Programming Experience
Beginner
we need to a code for image processing in c#
we need help to find intersection point of 2 lines in image
you can see my image as below we need to use from Emgu library in c# for find this points
we have a code but we don't know how to use it
if you can write this code for me that find intersection point of lines in my image thanks
i think the answer is here : find intersection point of two lines drawn using houghlines opencv
but it code need to change to use in c#
22.jpg

C#:
public static Vector3 Intersect(Vector3 line1V1, Vector3 line1V2, Vector3 line2V1, Vector3 line2V2)
{
    //Line1
    float A1 = line1V2.Y - line1V1.Y;
    float B1 = line1V1.X - line1V2.X;
    float C1 = A1*line1V1.X + B1*line1V1.Y;

    //Line2
    float A2 = line2V2.Y - line2V1.Y;
    float B2 = line2V1.X - line2V2.X;
    float C2 = A2 * line2V1.X + B2 * line2V1.Y;

    float det = A1*B2 - A2*B1;
    if (det == 0)
    {
        return null;//parallel lines
    }
    else
    {
        float x = (B2*C1 - B1*C2)/det;
        float y = (A1 * C2 - A2 * C1) / det;
        return new Vector3(x,y,0);
    }
}
 
Last edited:

Latest posts

Back
Top Bottom