ImageTransformations Here you can find python implementation of OpenCV methods for affine and perspective transformation. That is: getAffineTransform warpAffine getPerspectiveTransform warpPerspective Implementation is provided in an educative simplistic way with a lot of comments, visualization, and explanations. References https://math.stackexchange.com/questions/296794/finding-the-transform-matrix-from-4-projected-points-with-javascript https://stackoverflow.com/questions/8925569/perspective-projection-4-points