Question: Use the functions you defined in the Problem 2 to construct a single matrix which performs the following sequence of transformations ( in order )
Use the functions you defined in the Problem to construct a single matrix which performs the following sequence of transformations in order when acting on an image.
Stretch the image vertically by a factor of
Rotate the image pi radians clockwise.
Reflect the image over the line yx
Stretch the image horizontally by a factor of
save the resulting x matrix as compmatrix.
Funcitons defined in problem :
# This function should take a matrix of coordinates, and output a matrix which corresponds to the image that has been stetched in the
# horizantal direction by a factor of a and in the verticle direction by a factor of b
def stretchimage a b:
A nparraya
b
return npdotA image
# This function should take a matrix of coordinates, and output a matrix which corresponds to the image that has been sheared by a horizantal factor of a and
# a vertical factor of b
def shearimage a b:
A nparray a
b
return npdotA image
# This function should take a matrix of coordinates, and output a matrix which corresponds to the image that has been reflected in the
# line spanned by the vector abT
def reflectimage a b:
A nparraya bab
ab b aa b
return npdotA image
# This function should take a matrix of coordinates, and output a matrix which corresponds to the image that has been rotated in the
# counterclockwise direction by an angle of theta radians.
def rotateimage theta:
A nparraynpcosthetanpsintheta
npsintheta npcostheta
return npdotA image
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
