I added to my Python program where a user can click on 4 points and the coordinates of those points will be returned. Now the user selects the 4 corners of a rectangle in order and given the corresponding coordinates of those corners in a straightened image, the program straightens a warped image. If the user presses ‘c’ after the corners are selected the program will straighten the image. If the user presses ‘r’ the previous selections will be cleared and the user can select 4 new corners.
Here is a link to a folder with the program and images in it. You have to download the entire folder and run the Python program from within it.
An image of the output after the program is run: