# Calculate x distance to line from edge at middle of y?

Hi.

So right now I'm using HoughLines to find the distance to a line and the angle of the line. My problem is though that HoughLines calculates the distance to the line (rho) from the origin normal to the line which depends on the angle of the line as can be seen here (http://answers.opencv.org/question/29...).

I want to find the distance to the line in pixels at the middle of the frame and the angle of the line as this rough sketch shows: http://i.imgur.com/mNePsR7.png.

Any tips on how to do this? I would guess using HoughLinesP with the different output from HoughLines and doing some calculations would work, anyone done this before?

There is always only one line in the image and it is always longer than the camera frame.

Thanks!