Question: In python Example Code: Affine Transformation The Rotation operator multiplied the vector representing the coordinate by a matrix The affine transformation is quite similar but

 In python Example Code: Affine Transformation The Rotation operator multiplied the

In python

Example Code:

Affine Transformation

The Rotation operator multiplied the vector representing the coordinate by a matrix

The affine transformation is quite similar but the user defines the matrix

The example below creates a matrix mat that is altered from the rotation matrix, and the affine_transform function is then called that maps the coordinates according to this prescription

%matplotlib inline import matplotlib.pyplot as plt import imageio import scipy.ndimage as nd import numpy as np

def AffineExample(data): theta = 11 * np.pi/180 # 11 degrees in radians mat = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta/4), np.cos(theta)]]) data2 = nd.affine_transform(data, mat) return data2

url = 'https://raw.githubusercontent.com/joefoxva1/CDS468/master/Lecture2_3_4/bird_js.jpg' adata = imageio.imread(url, as_gray=1)

plt.title('Original Image') plt.imshow(adata, cmap='gray') plt.show()

mg2 = AffineExample(adata)

plt.title('Affine Image') plt.imshow(mg2, cmap='gray') plt.show()

Create an image with an affine transformation of 45 degrees and 90 degrees. Explain the 90 degree result

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!