Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started