NAME
dct_transform - performs Discrete Cosine Transform
SYNOPSIS
#include "CVIPtools.h"
#include "CVIPtoolkit.h"
#include "CVIPtransform.h"
Image* dct_transform(Image* inputImage, int blocksize)
<inputImage> - pointer to an Image structure
<blocksize> - block size
Image* idct_transform(Image* inputImage, int blocksize)
<inputImage> - pointer to an Image structure
<blocksize> - block size
PATH
$CVIPHOME/TRANSFORMS/dct.c
DESCRIPTION
dct_transform transforms an image from the spatial to the
frequency domain in a blockwise fashion using a discrete
cosine transform.
idct_transform performs the inverse 2D-dct_transform
transform.
TYPES AND CONSTANTS
None
RETURN VALUES
A pointer to an image structure with transformed image data
in VIP format
HISTORY
History information recorded: Discrete Cosine Transform.
Blocksize: #
EXAMPLE
#include <CVIPtoolkit.h>
#include <CVIPimage.h>
#include <CVIPconvert.h>
#include <CVIPview.h>
#include <CVIPtransform.h>
#include <math.h>
#include <sys/file.h>
#include <float.h>
#include <sys/types.h>
#include <sys/uio.h>
#define VIEWER "picture"
#define VIDEO_APP "SunVideo &"
void main()
{
Image *cvipImage;
IMAGE_FORMAT format;
char *inputfile,*outputfile;
setDisplay_Image(VIEWER, "Default");
print_CVIP("\n\t\tEnter the Input File Name: ");
inputfile =(char *) getString_CVIP();
format = getFormat_CVIP(inputfile);
cvipImage = read_Image(inputfile, 1);
view_Image(cvipImage, inputfile);
free(inputfile);
/* the following call performs a dct_transform on the input
image with block size equal to 8 */
cvipImage = dct_transform(cvipImage, 8);
print_CVIP("\n\t\tEnter the Output File Name: ");
outputfile = getString_CVIP();
view_Image(cvipImage,outputfile);
/* note the format is VIP */
write_Image(cvipImage,outputfile,CVIP_NO,CVIP_NO,VIP,1);
free(outputfile);
print_CVIP("\n\t\tEnter the Input File Name: ");
inputfile =(char *) getString_CVIP();
format = getFormat_CVIP(inputfile);
cvipImage = read_Image(inputfile, 1);
view_Image(cvipImage, inputfile);
free(inputfile);
/* the following call performs a inverse dct_transform
on the input image with block size equal to 8 */
cvipImage = idct_transform(cvipImage, 8);
print_CVIP("\n\t\tEnter the Output File Name: ");
outputfile = getString_CVIP();
view_Image(cvipImage,outputfile);
write_Image(cvipImage,outputfile,CVIP_NO,CVIP_NO,format,1);
free(outputfile);
}
SEE ALSO
libtransform
AUTHOR
Copyright (C) 1996 SIUE - by Scott E. Umbaugh and Jianxin
Tan.