Commit 86da37b2 authored by Taddeüs Kroes's avatar Taddeüs Kroes

improc ass4: Prettified 3d plot.

parent 00f34f99
...@@ -56,11 +56,14 @@ def Gauss1(s, order=0): ...@@ -56,11 +56,14 @@ def Gauss1(s, order=0):
# Make sure that the sum of all kernel values is equal to one # Make sure that the sum of all kernel values is equal to one
return W / W.sum() return W / W.sum()
def plot_mask(W, ax, stride): def plot_mask(W, ax):
"""""" """"""
x = arange(W.shape[0]) x = arange(W.shape[0])
Y, X = meshgrid(x, x) Y, X = meshgrid(x, x)
ax.plot_surface(X, Y, W, rstride=stride, cstride=stride, cmap='jet') #stride = s / 4
#ax.plot_surface(X, Y, W, rstride=stride, cstride=stride, cmap='jet')
ax.plot_surface(X, Y, W, rstride=1, cstride=1, linewidth=0, \
antialiased=True, cmap='jet')
ax.set_xlabel('x') ax.set_xlabel('x')
ax.set_ylabel('y') ax.set_ylabel('y')
ax.set_zlabel('g(x, y)') ax.set_zlabel('g(x, y)')
...@@ -100,7 +103,7 @@ if __name__ == '__main__': ...@@ -100,7 +103,7 @@ if __name__ == '__main__':
W, G = gD(F, s, int(argv[3]), int(argv[4])) W, G = gD(F, s, int(argv[3]), int(argv[4]))
subplot(131) subplot(131)
imshow(F, cmap='gray') imshow(F, cmap='gray')
plot_mask(W, subplot(132, projection='3d'), s / 4) plot_mask(W, subplot(132, projection='3d'))
subplot(133) subplot(133)
imshow(G, cmap='gray') imshow(G, cmap='gray')
elif argv[1] == 'timer': elif argv[1] == 'timer':
...@@ -147,7 +150,7 @@ if __name__ == '__main__': ...@@ -147,7 +150,7 @@ if __name__ == '__main__':
imshow(F, cmap='gray') imshow(F, cmap='gray')
# Gauss function (3D plot) # Gauss function (3D plot)
plot_mask(W, subplot(132, projection='3d'), s / 4) plot_mask(W, subplot(132, projection='3d'))
# Convolution # Convolution
subplot(133) subplot(133)
......
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