Commit dc7c99bb authored by Taddeüs Kroes's avatar Taddeüs Kroes

ImProc ass1: Improved imports.

parent af846a58
from numpy import * from numpy import empty, array, minimum, maximum, meshgrid, ix_, arange, \
correlate
def linfilter1(f, w): def linfilter1(f, w):
g = empty(f.shape, dtype=f.dtype) g = empty(f.shape, dtype=f.dtype)
...@@ -52,6 +53,7 @@ def linfilter3(f, w): ...@@ -52,6 +53,7 @@ def linfilter3(f, w):
return f[ix_(ii, jj)] return f[ix_(ii, jj)]
r = 0 * f r = 0 * f
for di, dj, weight in didjw: for di, dj, weight in didjw:
r += weight * translate(di, dj) r += weight * translate(di, dj)
......
from linfilters import * from linfilters import *
from pylab import imread, ones, plot, semilogy, savefig, show
from scipy.ndimage.interpolation import zoom from scipy.ndimage.interpolation import zoom
from pylab import *
from time import time from time import time
from sys import argv
repeat = 1 repeat = 1
w = (3, 11) w = (3, 11)
...@@ -28,6 +29,10 @@ for times in timings: ...@@ -28,6 +29,10 @@ for times in timings:
plot(x, times, 'o-') plot(x, times, 'o-')
semilogy() semilogy()
if len(argv) > 1:
savefig(argv[1])
show() show()
#subplot(1, 3, 1) #subplot(1, 3, 1)
......
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