Appendix D: MATLAB® Codes
D.1 Polynomial Interpolation
clear all; f1 = imread(‘1111.jpg’); f1 = f1(:,:,1); f1 = double(f1)/255; [M,N] = size(f1); h = [.5,.5]; g = filter(h,1,f1’); g = g(1:2:N,:); g = filter(h,1,g’); g = g(1:2:M,:); SNR = input(‘Enter the value of SNR in dB’); gg = im2col(g,[M/2,N/2],‘distinct’); n_var = var(gg)/10^(SNR/10) g = imnoise(g,‘gaussian’,0,n_var); key0 = input(‘Press 1 for Bilinear, 2 for Bicubic and 3 for Cubic Spline and 4 for cubic o-Moms’); key1 = input(‘press 1 for warped-distance and 2 for no warping’); key2 = input(‘press 1 for adaptive weights and 2 for no adaptation’); tic f = g; if (key0 = =3)|(key0 = =4) f = spline_coeff(g); fs = g; end; a = -1/2; [M,N] = size(f); ff = zeros(M,N); x = f(:,N-1:N); x ...
Get Image Super-Resolution and Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.