I got different image output while transformation stayed the same
im=np.ones((128,128))*255
src = np.array([
[56., 60.],
[81., 60.],
[64., 80.],
[49., 100.],
[78., 100.]], dtype=np.float32)
q=np.array([
[58.166317,39.124466],
[86.10652,26.917824],
[106.29474,39.68392],
[90.64203,72.82854],
[115.17699,63.91104]],dtype=np.float32)
tt=trans.SimilarityTransform()
tt.estimate(q,src)
dst1 = trans.warp(im,tt.inverse,preserve_range=True,output_shape=(128,128))
tt.estimate(src,q)
dst = trans.warp(im,tt,preserve_range=True,output_shape=(128,128))
So,you can see the difference, here are outputs:
UPD: Main issue is in "estimate" function, that estimate(q,src)!=(estimate(src,q))^-1. Still open question: why
To clarify the question: affine transformations is a group of transformations t:R2->R2
, where you have one determined inverse element for each (in our case - inverse transformation). In my question it appears that we have different transformations to the same source points (two inverse elements).
Actually, there is no mistake anywhere, just misunderstanding .inverse
and .estimate
function. t.estimate(q, src).inverse !=t.estimate(src, q)
but t.estimate(q, src).inverse ==t.estimate(t(q),q)