function [u,v,T] = ztrans2d(h);
% ZTRANS2D Computes the z-transform for the 2D GS-Filters
%
% Usage:
% [u,v,A] = ztrans2d(h)
% INPUT:
% h = (2n+1) x (2n + 1) matrix of filter coefffecients
% usually generated by sgsf2d.m and 2sgdf2d.m.
% OUTPUT:
% T = The Amplitude spectrum of the filters. These
% filteres are even-function with zero phase shift.
% [u,v] = +/- Frequency up to the Nyquist
%
% See also SGSF2D, SGDF2D
%
% Note: Savitzky-Golay Filter for differentiation and smoothing
% of 2D Images.
% ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
% Written by: Dr. A. Abokhodair Date: 1/2/2005
% ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
syms u v;
% Check input
[nR, nC] = size(h);
if ~(nR==nC);
error('Filter matrix is not SQUARE');
elseif ~isodd(nR) | ~isodd(nC)
error('Szie of filter matrix is not ODD');
end
N=(nR-1)/2;
[r,c]=meshgrid(-N:N);
Z1=exp(-i*r*u);
Z2=exp(-i*c*v);
Z=Z1.*Z2;
U=ones(1,nR);
H=U*(h.*Z)*U';
H=simplify(H);
T=char(H);
[u,v]=meshgrid(pi*(-1:0.025:1));
T=eval(T);
T=abs(T);
% figure; surfc(u/pi,v/pi,T);
% figure; contour(u/pi,v/pi,T,25);
% ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
function x = isodd (number)
% isodd(number)
% returns 1 if the number is Odd, 0 if it is even.
% Divide input by 2:
a = number/2;
whole = floor(a);
part = a-whole;
if part > 0;
x = 1;
else
x = 0;
end
% ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc