EE114_CA5 - Dylan Ler | 104172087 | EE114 Computer Assignment 5 2-D Convolution For MATLAB Code GenerateGaussian.m function h = GenerateGaussian(size

EE114_CA5 - Dylan Ler | 104172087 | EE114 Computer...

This preview shows page 1 - 6 out of 7 pages.

Dylan Ler | 104172087 | EE114 Computer Assignment 52-D ConvolutionFor MATLAB Code:GenerateGaussian.mfunction h = GenerateGaussian (size, lambda)this function generates a Gaussian matrix generate the meshgrid and the Gaussian matrix [x,y]= meshgrid([- size / 2 : 1 : size / 2]); h = exp( - (x .* x + y .*y) / lambda); find the sum and normalize the matrix sum_total = sum(sum(h)); h = h ./ sum_total;ConvolveImages.mfunction out = ConvolveImages (image, h)this function convolves two images and crop the result to the size of the first one get the dimensions of the input images [y_i, x_i] = size(image); [y_h, x_h] = size (h);% convolve the imagesout = uint8(conv2(image, h));%crop it to the correct sizeout = imcrop(out, [(x_h + 1)/ 2, (y_h + 1) / 2, x_i 1, y_i 1]);PSNR.m
Background image
function psnr = PSNR (i1, i2)
Background image
Background image
Background image
Background image
Image of page 6

You've reached the end of your free preview.

Want to read all 7 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture