Skip to content

Commit 63bf288

Browse files
committed
Move center of deswirl to make guessing parameters harder
1 parent a18514b commit 63bf288

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lectures/scripts/deswirl.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def swirl(image, center=None, strength=1, radius=100, rotation=0):
133133
# Read the input image, and compute its center
134134
mona = io.imread('../../images/mona_lisa.jpg')
135135
h, w, d = mona.shape
136-
center = [w/2, h/2]
136+
center = np.array([w/2, h/2])
137137

138138
# Construct three outputs: input image, swirled and deswirled
139139
f, (ax0, ax1, ax2) = plt.subplots(1, 3)
@@ -153,7 +153,8 @@ def swirl(image, center=None, strength=1, radius=100, rotation=0):
153153
ax2.set_xlabel('Restored using\nyour choice of\nparameters')
154154

155155
# Plot a dot to indicate the center-point of the reverse transform
156-
center_dot, = ax0.plot(center[0] + 10, center[1] - 5, 'ro')
156+
center += [10, -5]
157+
center_dot, = ax0.plot(center[0], center[1], 'ro')
157158
ax0.axis('image')
158159

159160
def update(event=None):

0 commit comments

Comments
 (0)