Question: need help writing a function in python. already started the code. In this step, you will write a function that takes affine parameters as Inputs
In this step, you will write a function that takes affine parameters as Inputs and returns a combined 3 x 3 matrix. V DO THIS: Write a function that takes seven Inputs and returns a transformation T. Nare this function affine_transform. These include the following: a - Rotation around the center of the image (-180,180). sx - Sale factor for the image in the x direction (0,5) sy - Sale factor for the image in the x direction (0.51 tx- translation in the x direction (pixels) ty - translation in the y direction (pixels) shx - Shear in the x direction (0,1) shy - Shear in the y direction (0.1) The order of these is very important. First, assume the image is already centered, then apply shear, scaling, rotation, and finish with translation. [66): ##Put your function here from ipywidgets import interact, interact_manual def affine_transform(a=@,sx 0.5, sy 8.5, tx, ty @,shx @, shy-): T- np.matrix([[1,0,0], [0,1,0], [0,0,1))) #Your transformations go here. a(-180, 180) a - -angle/18@ np.pi SH - np.matrix([[1, shx, o), Ishy, 1.0), [0,0,1))) S np.matrix(lisx,0,0), te,sy.ej, 16,0.1155 - np.matrix Inp.cos(a), np.sin(a), 61, Inp.sin(a), np.cos(a),e1, (0,0,111) np.matrix([11, e, tx), te, 1, tyl, l,8,111) TSHES RAT; #p2 Tkim; return T
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
