NAME
btc2_compress, btc2_decompress - a Block Truncation Coding
(BTC) scheme using multilevel coding
SYNOPSIS
#include "CVIPtoolkit.h"
#include "CVIPconvert.h"
#include "CVIPdef.h"
#include "CVIPimage.h"
#include "CVIPhisto.h"
#include <sys/types.h>
#include <sys/stat.h>
int btc2_compress(Image *inputImage, char *filename, int
blocksize)
<inputImage> - pointer to an Image structure
<filename> - character array
<blocksize> - blocksize
Image* btc2_decompress(char *filename)
<filename> - character array
PATH
$CVIPHOME/COMPRESSION/m_btc.c
DESCRIPTION
Multilevel BTC is a form of block truncation coding that
greatly improves the resulting image fidelity compared to
the use of the standard BTC, when applied to visually com-
plex images. The improvement comes from the use of a minmax
error criterion in place of the conventional two-level
moment-preserving quantizer. This approach to implementation
uses block quantization map encoding and decoding.
The function code was developed from "Multilevel Block Trun-
cation Coding Using a Minimax Error Criterion for High-
Fidelity Compression of Digital Images.", Yiyan Wu and David
C. Coll, IEEE TRANSACTIONS ON COMMUNICATIONS. VOL.41, NO.8,
AUGUST 1993
TYPES AND CONSTANTS
None
RETURN VALUES
btc2_compress: 0 on success, -1 on failure
btc2_decompression: an uncompressed image pointer on
success,a NULL pointer on failure
HISTORY
History information recorded: None
EXAMPLE
#include <CVIPtoolkit.h>
#include <CVIPimage.h>
#include <CVIPconvert.h>
#include <CVIPdef.h>
#include <CVIPhisto.h>
#include <CVIPcompress.h>
void main() {
Image *cvipImage, *outImage;
IMAGE_FORMAT format;
char *inputfile, *outputfile;
int blocksize;
print_CVIP("\n\t\tEnter the Input File Name: ");
inputfile =(char *) getString_CVIP();
cvipImage = read_Image(inputfile, 1);
view_Image(cvipImage, inputfile);
print_CVIP("\n\t\tEnter the block size:");
blocksize = getInt_CVIP(10, 0, 64);
print_CVIP("\n\t\tEnter the Compressed File Name:");
outputfile =(char *) getString_CVIP();
if (btc2_compress(cvipImage,outputfile,blocksize)<0) {
error_CVIP("btc2_compress", "compression failed");
exit(1);
} else if ((outImage=btc2_decompress(outputfile))==NULL){
error_CVIP("btc2_decompress", "decompression failed");
exit(1);
} else view_Image(outImage, outputfile);
free(inputfile);
free(outputfile);
}
BUGS
None at this time
SEE ALSO
libcompress, btc_compress(), btc_decompress(),
btc3_compress(), btc3_decompress()
AUTHOR
Copyright (C) 1996 SIUE - by Scott Umbaugh, Zhen Li, and
Hong Niu.