The default OpenCV command "getAffineTransform" gives a 2x3 matrix. I would like to know how to get a 3x3 matrix.
Looking at the OpenCV docs, notice that a 3x3 affine transformation matrix is of the form
r00 r01 tx
r10 r11 ty
0 0 1
So the last row is always [0 0 1]. Here, r is the rotational part and t is the translational part. A usual trick to save space is to represent affine 3x3 matrices as 2x3 matrices by just forgetting the last row, i.e.
r00 r01 tx
r10 r11 ty
So you just have to append a last row of [0 0 1] to it in order to get your 3x3 matrix.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With