[37] | 1 | function Y = qdft2(X, A, L) |
---|
| 2 | % QDFT2 Discrete quaternion 2D Fourier transform. |
---|
| 3 | % |
---|
| 4 | % This function computes the two-dimensional discrete quaternion Fourier |
---|
| 5 | % transform of X, which may be a real or complex quaternion matrix. |
---|
| 6 | % A is the transform axis and it may be a real or complex pure quaternion. |
---|
| 7 | % It need not be a unit pure quaternion. L may take the values 'L' or 'R' |
---|
| 8 | % according to whether the hypercomplex exponential is to be multiplied |
---|
| 9 | % on the left or right of X. |
---|
| 10 | % |
---|
| 11 | % This function uses direct evaluation using a matrix product, and it is |
---|
| 12 | % intended mainly for verifying results against fast transform |
---|
| 13 | % implementations such as qfft2.m. See also: iqdft2.m. |
---|
| 14 | |
---|
| 15 | % Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan. |
---|
| 16 | % See the file : Copyright.m for further details. |
---|
| 17 | |
---|
| 18 | error(nargchk(3, 3, nargin)), error(nargoutchk(0, 1, nargout)) |
---|
| 19 | |
---|
| 20 | if size(A) ~= [1, 1] |
---|
| 21 | error('The transform axis cannot be a matrix or vector.'); |
---|
| 22 | end |
---|
| 23 | |
---|
| 24 | if ~isa(A, 'quaternion') | ~ispure(A) |
---|
| 25 | error('The transform axis must be a pure quaternion.') |
---|
| 26 | end |
---|
| 27 | |
---|
| 28 | if L ~= 'L' & L ~= 'R' |
---|
| 29 | error('L must have the value ''L'' or ''R''.'); |
---|
| 30 | end |
---|
| 31 | |
---|
| 32 | A = unit(A); % Ensure that A is a unit (pure) quaternion. |
---|
| 33 | |
---|
| 34 | % Compute the transform. This is done by row/column separation, that is we |
---|
| 35 | % compute the QDFT of the rows, then the QDFT of the columns. This is |
---|
| 36 | % faster than a direct implementation, and easier, because the direct |
---|
| 37 | % implementation would require a block matrix for the exponentials, which |
---|
| 38 | % Matlab cannot support. |
---|
| 39 | |
---|
| 40 | Y = qdft(qdft(X, A, L).', A, L).'; |
---|