I am currently working on a project that requires me to be able to take a picture of a document (say sheet music, for example) and transform that image so it looks like the picture was taken from directly above. This functionality is similar to the app "Office Lens". Most likely, this is a problem in Linear Algebra, but I have never taken it and my friends who have taken it have no clue.
The problem is, given a picture of a document and given the four coordinates of the corners of the document and the ratio of its sides, how can I transform the picture to make the document look like it was taken from above?
My first idea was to consider a coordinate (x,y) in the picture and then define the new coordinates (x', y') to be angles from a point of intersection made by the sides of the document, but this makes no sense. If I did this, the image would appear distorted. How can I do this?