I am trying to create a function
zaa = antialias(z);
which inputs a hi-res image z and outputs high-res anti-aliased image zaa. The system needs to compute each point of zaa[x,y]:
.
The given "high-res" image z is:
z = round(exp(-1/w.^2*((y.'-30).^2+(x-40).^2)));
I am confused on how to implement the Zaa equation into my function. Here's what I have for my function thus far:
function zaa = antialias(z) zaa = zeros(size(z,1), size(z,2)); for nn = 1:size(z,1) % grabs the number of rows
for mm = 1:size(z,2) % grabs number of columns
if nn > 1 && nn < size(z,1) && mm > 1 && mm < size(z,2) %zaa(nn,mm) = 1/4 * (z(nn-1,mm)+z(nn+1,mm)+z(nn,mm-1)+z(nn,mm+1));
%zaa(nn,mm) = 1/4 * z(nn-1,nn+1,mm-1,mm+1);
%zaa(nn,mm) = 1/4 * z(nn,mm);
%xx = [nn-1 nn+1 nn nn];
%yy = [mm mm mm-1 mm+1];
%zaa(nn,mm) = 1/4 * z(xx,yy);
end endendend
The commented out section includes my 4 attempts at coding in the difference equation. I'm sure you can tell I am a novice with arrays and MATLAB. I am hoping for some guidence on how to write the function appropriately. Any help would be appreciated.
Thanks!
Best Answer