Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

your coords are simply wrong. it also gets easier, if you use image measurements, like W and H from your original image (and really go clockwise, say what you mean, mean what you say !):

H=im.shape[0]
W=im.shape[1]
src = np.array([[32, 25], [585,81], [585,356], [41,570]], np.float32)
dst = np.array([[0, 0],   [W, 0],   [W, H],    [0, H]], np.float32)
M = cv2.getPerspectiveTransform(src, dst)
warped = cv2.warpPerspective(im, M, (W, H))

image description

your coords are simply wrong. it also gets easier, if you use image measurements, like W and H from your original image (and really go clockwise, say what you mean, mean what you say !):image:

H=im.shape[0]
W=im.shape[1]
src = np.array([[32, 25], [585,81], [585,356], [41,570]], np.float32)
dst = np.array([[0, 0],   [W, 0],   [W, H],    [0, H]], np.float32)
M = cv2.getPerspectiveTransform(src, dst)
warped = cv2.warpPerspective(im, M, (W, H))

image description