Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think I made this question sound a lot more complicated than it is. Essentially I just want to get and then apply an affine transformation to a set of points which means multiplying the [point matrix|1] with the transform matrix.

The solution (for translation) is:

arr = np.array([[1,2], [3,4]])

dx = 1
dy = 1
M = np.int32([[1,0,dx],[0,1,dy]])

np.dot(np.c_[arr, np.ones(arr.shape[1])], M.T)

I think I made this question sound a lot more complicated than it is. Essentially I just want to get and then apply an affine transformation to a set of points which means multiplying the [point matrix|1] with the transform matrix.

The solution (for translation) is:

arr = np.array([[1,2], [3,4]])

dx = 1
dy = 1
M = np.int32([[1,0,dx],[0,1,dy]])

np.dot(np.c_[arr, np.ones(arr.shape[1])], np.ones(arr.shape[0])], M.T)