Transform2DForward() -- Forward 2D Cosine/Walsh/Hadamard Transform

Perform 2D forward Cosine/Walsh/Hadamard transform on a potentially large image which may not entirely fit into memory. The algorithm is based on a series of 1D transforms on the rows and columns of the image. If necessary, a disk buffer is used to store intermediate transform result.

See Also: Transform2DInverse(), FFT2DForward(), FFT2DInverse(), FFTAndFilter(), IMPProgressFunc

CALL SEQUENCE

TBool Transform2DForward ( nTform, fpIn, dbic, dbiw, fpOut, dboc,
                         dbow, bZeroInCenter, 
                         pfnProgress,pProgressArg );
int     nTform;
           Indicates the type of transform: valid types are
           T_COS (Cosine transform), T_WAL (Walsh transform),
           T_HAD (Hadamard transform).
FILE    *fpIn;
           File pointer of the input database file.
int     *dbic;
           Array of 1 input channel.
int     *dbiw;
           Offset and size of input window.
FILE    *fpOut;
           File pointer of the output database file.
int     *dboc;
           Array of 1 output channel. The channel type
           should be 32-bit real.
int     *dbow;
           Offset and size of output window. Window size
           should be a power of 2 and should be equal to
           or larger than the input window size.
TBool   bZeroInCenter;
           Indicates whether zero frequency should be
           shifted to the image center. Normally in the
           transform result, zero frequency is in the
           upper-left corner of the image. If this
           parameter is set to TRUE, the 4 quadrants
           of transform image will be reordered so that
           zero frequency is at the image center.
IMPProgressFunc pfnProgress;
       is the pointer to a progress counter function.  See
       IMPProgressFunc for details.
void*   pProgressArg;
       is the callback data argument to the pfnProgress() function.
Transform2DForward() returns 1 if the data are suitable for filtering, and returns 0 otherwise.

EXAMPLE

Perform 2D forward Cosine on a 256x256 window on the upper-left corner of channel 1 of file "irvine.pix". The transform output is to be saved in channel 8 "irvine.pix". Zero frequency is to be saved in the upper-left corner of image.

    FILE    *fpIn, *fpOut;
    int     dbic[1], dbiw[4], dboc[1], dbow[4];

    fpIn = fpOut = IDBOpen ( "irvine.pix", "r+");
    dbic[0] = 1;
    dbiw[0] = dbiw[1] = 0;
    dbiw[2] = dbiw[3] = 256;
    dboc[0] = 8;
    dbow[0] = dbow[1] = 0;
    dbow[2] = dbow[3] = 256;

    Transform2DForward (T_COS, fpIn, dbic, dbiw, fpOut, dboc,
                        dbow, FALSE, IMPTermProgressCounter, NULL);
Transform2DInverse() -- Inverse 2D Cosine/Walsh/Hadamard Transform

Transform2DInverse() -- Inverse 2D Cosine/Walsh/Hadamard Transform

Perform 2D inverse Cosine/Walsh/Hadamard transform on a potentially large image which may not entirely fit into memory. The algorithm is based on a series of 1D transforms on the rows and the columns of the image. If necessary, a disk buffer is used to store intermediate transform result.

See Also: Transform2DForward(), FFT2DForward(), FFT2DInverse(), FFTAndFilter()

CALL SEQUENCE

TBool Transform2DInverse ( nTform, fpIn, dbic, dbiw, fpOut, dboc,
                         dbow, szFILB, bZeroInCenter, 
                         pfnProgress,pProgressArg );
int     nTform;
           Indicates the type of transform: valid types are
           T_COS (Cosine transform), T_WAL (Walsh transform),
           T_HAD (Hadamard transform).
FILE    *fpIn;
           File pointer of the input database file.
int     *dbic;
           Array of 1 input channel.
int     *dbiw;
           Offset and size of input window. Size should be
           a power of 2 (e.g., 64, 128, 256, 512, 1024 etc.)
FILE    *fpOut;
           File pointer of the output database file.
int     *dboc;
           Array of 1 output channel.
int     *dbow;
           Offset and size of output window. Window size
           should not be larger than input window size.
char    *szFILB;
           Name of a pix file used as a disk buffer. It is
           only used when the entire image does not fit
           into memory. If szFILB is a null string but a
           buffer is needed, a file name is automatically
           generated and saved in szFILB on return.
TBool   bZeroInCenter;
           Indicates whether zero frequency is located in
           the image center. If so, it will be shifted back
           to the upper-left corner before the inverse
           transform.
IMPProgressFunc pfnProgress;
       is the pointer to a progress counter function.  See
       IMPProgressFunc for details.
void*   pProgressArg;
       is the callback data argument to the pfnProgress() function.
Transform2DInverse() returns 1 if the data are suitable for filtering, and returns 0 otherwise.

EXAMPLE

Perform 2D inverse Cosine transform on a 0,0,256,256 window of frequency image in channel 8 of "irvine.pix". Output image is to be saved in channel 7 of "irvine.pix". Zero frequency is at the upper-left corner. Use the name "tmpbuf.pix" for buffer file if it is needed.

    FILE    *fpIn, *fpOut;
    int     dbic[1], dbiw[4], dboc[1], dbow[4];
    char    szFILB[65];

    fpIn = fpOut = IDBOpen ( "irvine.pix", "r+");
    dbic[0] = 8;
    dbiw[0] = dbiw[1] = 0;
    dbiw[2] = dbiw[3] = 256;
    dboc[0] = 7;
    dbow[0] = dbow[1] = 0;
    dbow[2] = dbow[3] = 256;
    strcpy(szFILB, "tmpbuf.pix");

    Transform2DInverse (T_COS, fpIn, dbic, dbiw, fpOut, dboc,
                        dbow, szFILB, FALSE, IMPTermProgressCounter,
                        NULL);

About PCI Help Gateway