NAME
zon_compress, zon_decompress - compress and decompress an
image using zonal coding
SYNOPSIS
int zon_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 * zon_decompress(char * filename)
<filename> - pointer to a character array
PATH
$CVIPHOME/COMPRESSION/zonal.c
DESCRIPTION
The program consists of two parts: zon_compress() and
zon_decompress(). zon_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.
zon_decompress() performs the inverse process of
zon_compress().
TYPES AND CONSTANTS
None
RETURN VALUES
zon_compress: 0 on success, -1 on failure
zon_decompression: an uncompressed image pointer on success,
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 dc quantisation */
zon_compress(cvipImage,"file1",32,2,1,2);
/* the following call performs the zonal decoding of
the "file1" */
cvipImage=zon_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, zon2_compress
AUTHOR
Copyright (C) 1996 SIUE - by Scott E. Umbaugh and Wenxing
Li.