[EDITED] Here's how it's done.
Steps:
1. Isolate the Road Divider Part.
![Cropped Image](https://cdn.statically.io/img/i.sstatic.net/eDWtH.jpg)
![Isolate the Yellow strips](https://cdn.statically.io/img/i.sstatic.net/RJbw8.jpg)
Then, using Houghlines, find out the longest lines in Image. Find out the extrema points that cross image boundary. You got the Quadilateral points. I skipped this part by Manually Choosing them. In my case, the width of road at top of image is 10, and at bottom is 60.
![The Quadilateral to Transform](https://cdn.statically.io/img/i.sstatic.net/usn1P.png)
Now, for the Destination, we have to Image so that Divider Quadilateral has uniform width of 60, so we save in another array new points, which have same bottom points, but top points are modified as they form a rectangle with height same as image (or bigger, you can adjust as it suits you after running it once and seeing the results), but width 60. Remember, we are transforming our image such that the divider fits into this Rectangular Area. Image will change automatically.
Now, using
Mat TransformMat = getPerspectiveTransform(ipPts, opPts);
of opencv on initial and destination quadilateral Points, we get a Transform Matrix, Which we apply to our Test Image.
warpPerspective(ipImg, opImg, TransformMat, ipImg.size());
![Transformed Image](https://cdn.statically.io/img/i.sstatic.net/y8I5f.png)
You'll see a lot of Area is Cropped to fit the Output in InputImage Size. However you'll notice that Image is Transformed to get parallel Divider, as we Expected. By performing some Translation and Stuff, and taking a bigger Size Output Image, You'll get this. We can never get a perfectly wrapped Output Image, since its size can be very large. But we'll reach some constraint that'll fulfill our task. Here's Last image :
![Final Tansformed Image](https://cdn.statically.io/img/i.sstatic.net/qiBFE.jpg)