def test_conjugate_grad_descent():
  im=io.imread('data/pru.png')
  kernel=a8.gauss2D(1)
  im_blur=a8.convolve3(im, kernel)

  io.imwrite(im_blur, 'pru_blur.png')
  im_sharp=a8.deconvCG(im_blur, kernel);
  io.imwrite(im_sharp, 'pru_sharp_CG.png')
Esempio n. 2
0
def test_conjugate_grad_descent():
  im=io.imread('data/pru.png')
  kernel=a8.gauss2D(1)
  im_blur=a8.convolve3(im, kernel)

  io.imwrite(im_blur, 'pru_blur.png')
  im_sharp=a8.deconvCG(im_blur, kernel);
  io.imwrite(im_sharp, 'pru_sharp_CG.png')
def test_real_psf25():
  im=io.imread('data/pru.png')
  f=open('psf', 'r')
  psf=[map(float, line.split(',')) for line in f ]
  kernel=np.array(psf)
  im_blur=a8.convolve3(im, kernel)
  #kernel=kernel[::-1, ::-1]
  io.imwrite(im_blur, 'pru_blur_real25.png')
  io.imwriteGrey(kernel/np.max(kernel), 'psf25.png')
  im_sharp=a8.deconvCG(im_blur, kernel, 25);
  io.imwrite(im_sharp, 'pru_sharp_CG_real25.png')
Esempio n. 4
0
def test_real_psf():
  im=io.imread('data/pru.png')
  f=open('psf', 'r')
  psf=[map(float, line.split(',')) for line in f ]
  kernel=np.array(psf)
  im_blur=a8.convolve3(im, kernel)
  #kernel=kernel[::-1, ::-1]
  io.imwrite(im_blur, 'pru_blur_real.png')
  io.imwriteGrey(kernel/np.max(kernel), 'psf.png')
  im_sharp=a8.deconvCG(im_blur, kernel, 20);
  io.imwrite(im_sharp, 'pru_sharp_CG_real.png')
def test_conjugate_grad_descent_reg():
  im=io.imread('data/pru.png')
  kernel=a8.gauss2D(1)
  im_blur=a8.convolve3(im, kernel)
  noise=np.random.random(im_blur.shape)-0.5
  im_blur_noisy=im_blur+0.05*noise

  io.imwrite(im_blur_noisy, 'pru_blur_noise.png')
  im_sharp=a8.deconvCG_reg(im_blur_noisy, kernel);
  im_sharp_wo_reg=a8.deconvCG(im_blur_noisy, kernel);
  io.imwrite(im_sharp, 'pru_sharp_CG_reg.png')
  io.imwrite(im_sharp_wo_reg, 'pru_sharp_CG_wo_reg.png')
Esempio n. 6
0
def test_conjugate_grad_descent_reg():
  im=io.imread('data/pru.png')
  kernel=a8.gauss2D(1)
  im_blur=a8.convolve3(im, kernel)
  noise=np.random.random(im_blur.shape)-0.5
  im_blur_noisy=im_blur+0.05*noise

  io.imwrite(im_blur_noisy, 'pru_blur_noise.png')
  im_sharp=a8.deconvCG_reg(im_blur_noisy, kernel);
  im_sharp_wo_reg=a8.deconvCG(im_blur_noisy, kernel);
  io.imwrite(im_sharp, 'pru_sharp_CG_reg.png')
  io.imwrite(im_sharp_wo_reg, 'pru_sharp_CG_wo_reg.png')