Commit 8ab571b3 authored by Taddeüs Kroes's avatar Taddeüs Kroes

improc ass4: Fixed integer/float problem.

parent 8c79a839
......@@ -15,9 +15,9 @@ def exit_with_usage():
def Gauss(s):
"""Create a sampled Gaussian function of scale s."""
size = int(ceil(3 * s))
r = 2 * int(ceil(3 * s)) + 1
r = 2 * size + 1
W = zeros((r, r))
t = s ** 2
t = s ** 2.
a = 1 / (2 * pi * t)
# Sample the Gaussian function
......@@ -59,7 +59,7 @@ elif argv[1] == 'diff':
if len(argv) < 3:
exit_with_usage()
s = int(argv[2])
s = float(argv[2])
W = Gauss(s)
G = convolve(F, W, mode='nearest')
......@@ -67,11 +67,11 @@ elif argv[1] == 'diff':
subplot(131)
imshow(F, cmap='gray')
# Gauss function
# Gauss function (3D plot)
x = arange(W.shape[0])
X, Y = meshgrid(x, x)
ax = subplot(132, projection='3d')
stride = s / 3
stride = s / 4
ax.plot_surface(X, Y, W, rstride=stride, cstride=stride, cmap='jet')
ax.set_xlabel('x')
ax.set_ylabel('y')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment