import cv2
import numpy as np
import matplotlib.pyplot as plt
src = cv2.imread('test.jpg')
rows,cols = src.shape[:2]
pos1 = np.float32([[114,82],[287,156],[8,100],[143,177]])
pos2 = np.float32([[0,0],[188,0],[0,262],[188,262]])
M = cv2.getPerspectiveTransform(pos1,pos2)
result = cv2.warpPerspective(src,M,(2*cols,2*rows))
cv2.imshow("original",src)
cv2.imshow("result",result)
cv2.waitKey(0)
cv2.destoryAllWindows()