Interactive affine and metric image rectification in Python. Click coplanar parallel and perpendicular lines on any image to rectify it, displaying and saving the output. Three scripts are provided.
Select two parallel lines in an image and do affine rectification via the vanishing line following Fig. 2.13 in Hartley and Zisserman. Images are rotated to keep the first selected line horizontal and translated and scaled to keep the warped image contained just within the image matrix.
Select two perpendicular lines in an image and do affine rectification via the vanishing line following Example 2.26 in Hartley and Zisserman. Images are translated and scaled to keep the warped image contained just within the image matrix.
Do affine followed by metric rectification. Images are translated and scaled once after both stages to keep the image contained just within the image matrix.
OpenCV Python, matplotlib, numpy, scipy
Hartley, Richard, and Andrew Zisserman. Multiple view geometry in computer vision. Cambridge university press, 2003.