NAME
zon2_compress, zon2_decompress - compress and uncompress an
image using zonal coding
SYNOPSIS
int zon2_compress(Image * inputImage, char *filename, int
block_size, int choice, int mask_type, float compress_ratio)
<inputImage> - pointer to an image
<filename> - pointer to a character array
<block_size> - a power of 2; kernel size is <block_size>^2
<choice> - transform to use:
1=FFT 2=DCT 3=Walsh 4=Hadamard
<mask_type> - type of kernel to use:
1=triangle 2=square 3=circle
<compress_ratio> - compression ratio, from 1.0 (min)
to (block_size*block_size/4) (max)
for all kinds of transforms
Image * zon2_decompress(char * filename)
<filename> - pointer to a character array
PATH
$CVIPHOME/COMPRESSION/zonal2.c
DESCRIPTION
The program consists of two parts: zon2_compress() and
zon2_decompress(). zon2_compress() first performs a
selected transform on the input image, forms a kernel
according to arguments block_size, mask_type and
compress_ratio, then uses the kernel to sample the transform
of the input image, maps the result to CVIP_BYTE data
(unsigned char) and stores them in the file filename.
zon2_decompress() performs the inverse process of
zon2_compress().
The difference between zon_compress() and zon2_compress() is
that in zon_compress(), the DC component is included into
local remapping; while it is not included in zon2_compress()
coding.
TYPES AND CONSTANTS
None
RETURN VALUES
zon2_compress: 0 on success, -1 on failure
zon2_decompression: an uncompressed image pointer on suc-
cess, a NULL pointer on failure
HISTORY
History information recorded: None
DIAGNOSTICS
The input image is a real image, it can be multi_band and of
any of these data types: CVIP_BYTE, CVIP_SHORT,
CVIP_INTEGER, CVIP_FLOAT or CVIP_DOUBLE.
EXAMPLE
#include <CVIPtoolkit.h>
#include <CVIPimage.h>
#include <CVIPdef.h>
#include <CVIPconvert.h>
#include <CVIPview.h>
#include <sys/types.h>
#include <sys/stat.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 the zonal coding of the
input image with no dc quantisation */
zon2_compress(cvipImage,"file1",32,2,1,2);
/* the following call performs the zonal decoding of the
"file1" */
cvipImage=zon2_decompress("file1");
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
libcompress, zon_compress
AUTHOR
Copyright (C) 1996 SIUE - by Scott E. Umbaugh and Wenxing
Li.