Lets think, I would take a picture of a sheet on a table in an angle, that is not frontal. Of course, I will have a perspectivly stretched image.
Does anyone know an easy algorithm to “normalize” the area again to a sqared one, when all 4 edges/edgepoints in the source (taken photo) are defined/maybe clicked by the user?
The interpolation may be easy, I do not need algorithms to have smooth borders, nearest neighbour is enough (so, simply copying the pixel from the source position, which meets the rounded value from the calculated according pixel, ignoring the after-commas).
OpenCV has it all.
Basically, you get the 4 points and use
http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#getperspectivetransform
(which basically inverts a matrix inside) to obtain the perspective transformation matrix, and then use
http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#warpperspective
to apply the perspective transformation on the image.
The algorithms inside the latter can be found in http://en.wikipedia.org/wiki/Texture_mapping