Flexible perspective correction
Now that we have implemented the rigid correction, we want to get slightly better results. As discussed before, the main reason to use the perspective correction is to find the four corner points of the object of interest. In the Rigid perspective correction section, we used the estimated bounding rectangle to find the corners of the object of interest; however, as you know, every opposite side of a rectangle is parallel, and this might degrade the results of the perspective correction because parallel lines in the real world have to intersect in what is called a vanishing point when projected to the picture plane.
So, having parallel lines to estimate the corners is not our best option and we can do better by keeping the projected lines (the ones that we found from the Hough transform) in the picture as is and use simple geometry to find the intersection between them in order to find the four corners.
The steps that we will perform are as follows:
- Convert the...