represent coordinates in 2 dimensions with 3-vector
Add a 3rd coordinate to every 2D point
(x, y, w)-> (x/w, y/w)
(x, y, 0) => infinity
p’ = Mp
Projective Transformations
– combination of affine transformations and projective warps
Properties
– origin does not necessarily map to origin
– lines map to lines
import cv2 import numpy as numpy img = cv2.imread('tech.png') height, width = img.shape[:2] cv2.imshow("Original", img) M_trans = np.float32( [[1, 0, 100], [0, 1, 50]]) print "Translation matrix:" print M_trans img_trans = cv2.warpAffine(img, M_trans, (width, height)) cv2.imshow("translation", img_trans)