def timeChallenge(): im = io.imread('zebra.png') t1=time.time() a3.gaussianBlur(im,2, 3) print time.time()-t1, 'seconds for Gaussian Blur' t2=time.time() a3.convolve(im, a3.gauss2D()) print time.time()-t2, 'seconds for Convolve'
import a3 import imageIO as io import time zebra = io.imread('zebra.png') print 'Begin separable Gaussian' start = time.time() zebra1 = a3.gaussianBlur(zebra, 3, 3) end = time.time() print end - start, 'seconds' print 'Begin 2D Gaussian' start = time.time() zebra2 = a3.convolve(zebra, a3.gauss2D(3, 3)) end = time.time() print end - start, 'seconds' io.imwrite(zebra1, 'zebraSeparableGaussian.png') io.imwrite(zebra2, 'zebra2DGaussian.png')
def test_equal(): im=io.imread('pru.png') out1=a3.convolve(im, a3.gauss2D()) out2=a3.gaussianBlur(im,2, 3) res=abs(out1-out2); return (sum(res.flatten())<0.1)
def test_gaussianBlur(): im=io.imread('pru.png') out=a3.gaussianBlur(im, 2,3) io.imwrite(out, 'my_gaussBlur.png')