Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python help with images. Need procedures to do the following two things. transla

ID: 3684938 • Letter: P

Question

Python help with images. Need procedures to do the following two things. translation and scaling.

##Problem 1
def translation(alpha,beta):
'''
Input: a scalar alpha (the increase to the x-coordinate) and a scalar beta (the increase to the y-coordinate)
Output: 3x3 matrix that, when multiplied by a location vector representing (x,y),
yields the location vector of the translated point (x+alpha, y+beta).

>>> translation(4,-5) * Vec({'x','y','u'}, {'x':2, 'y':3, 'u':1}) == Vec({'x','y','u'}, {'x':6, 'y':-2, 'u':1})
True
'''
  

## Problem 2
def scale(alpha, beta):
'''
Input: a scalar alpha (the multiplier for the x-coordinate) and a scalar beta (the multiplier for the y-coordinate)
Output: 3x3 matrix that, when multiplied by a locaiton vector representing (x,y),
yields the locaiton vector of the scaled point (alpha*x, beta*y).

>>> scale(3,4)*Vec({'x','y','u'}, {'x':1,'y':2,'u':1}) == Vec({'x','y','u'}, {'x':3, 'y':8, 'u':1})
True
>>> scale(0,0)*Vec({'x','y','u'}, {'x':1,'y':1,'u':1}) == Vec({'x','y','u'}, {'u':1})
True
'''

Explanation / Answer

Scaling

Then create your translation matrix

TranMatrix = zero(4,-5)

use this code for the above problem.