Skip to content

Commit

Permalink
moved creating mask entirely to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
mario authored and mario committed Mar 25, 2020
1 parent 096fb07 commit 5a5cfb2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions simple_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def create_mapping(self, parameters):
vf_angle = np.angle(vf_x + vf_y * 1j)
vf_radius = np.abs(vf_x + vf_y * 1j)

self.mask = vf_radius <= num_cells
mask = vf_radius <= num_cells
self.mask = np.tile(mask, (3,1)).transpose()

new_radius = self.fii(vf_radius) / degree_per_pixel

Expand Down Expand Up @@ -102,11 +103,8 @@ def __adjust_image_dims__(image):
def distort_image(self, image):

image = self.__adjust_image_dims__(image)

msk = np.tile(self.mask, (3,1)).transpose()

image = np.reshape(image, (self.num_pixels_in, 3))
output = np.multiply(sparse.dot(self.W, image), msk)
output = np.multiply(sparse.dot(self.W, image), self.mask)
output = np.reshape(output, (self.resolution_out, self.resolution_out, 3)).astype(np.uint8)

return output
Expand Down

0 comments on commit 5a5cfb2

Please sign in to comment.