fvq Performs the vector quantization of an image
fvq [-p PrintSNR] [-h] [-M] [-m] [-n NCB1] [-X NCB2] [-Y NCB3] [-Z NCB4] [-x CodeBook2] [-y CodeBook3] [-z CodeBook4] [-A NResCB1] [-B NResCB2] [-C NResCB3] [-D NResCB4] [-a ResCodeBook1] [-b ResCodeBook2] [-c ResCodeBook3] [-d ResCodeBook4] [-E NResResCB1] [-F NResResCB2] [-e ResResCodeBook1] [-f ResResCodeBook2] [-o Compress] Image CodeBook1 QImage
-p PrintSNR : 1 - > print info on classified VQ
-h : Insert only a reduced header at top of Compress
-M : Encode bitmap even if all codebooks have size 1
-m : Compute rate distortion curve
-n NCB1 : Index of codebook in CodeBook1
-X NCB2 : Index of codebook in CodeBook2
-Y NCB3 : Index of codebook in CodeBook3
-Z NCB4 : Index of codebook in CodeBook4
-x CodeBook2 : Sequence of codebooks for second class (fimage)
-y CodeBook3 : Sequence of codebooks for third class (fimage)
-z CodeBook4 : Sequence of codebooks for fourth class (fimage)
-A NResCB1 : Index of codebook in ResCodeBook1
-B NResCB2 : Index of codebook in ResCodeBook2
-C NResCB3 : Index of codebook in ResCodeBook3
-D NResCB4 : Index of codebook in CodeBook4
-a ResCodeBook1 : Codebook for residu quantization after quantization with CodeBook1 (fimage)
-b ResCodeBook2 : Codebook for residu quantization after quantization with CodeBook2 (fimage)
-c ResCodeBook3 : Codebook for residu quantization after quantization with CodeBook3 (fimage)
-d ResCodeBook4 : Codebook for residu quantization after quantization with CodeBook4 (fimage)
-E NResResCB1 : Index of codebook in ResResCodeBook1
-F NResResCB2 : Index of codebook in ResResCodeBook2
-e ResResCodeBook1 : Codebook for residu quantization after quantization with CodeBook1 and ResCodeBook1 (fimage)
-f ResResCodeBook2 : Codebook for residu quantization after quantization with CodeBook2 and ResCodeBook2 (fimage)
-o Compress : Compressed representation of Image (cimage)
Image : Input Fimage (fimage)
CodeBook1 : Sequence of codebooks for first class (fimage)
QImage : Quantized image (fimage)
screen output :
screen output :
screen output :
screen output :
void fvq (PrintSNR , SmallHeader , BitMapCode , RateDist , NCB1 , NCB2 , NCB3 , NCB4 , CodeBook2 , CodeBook3 , CodeBook4 , NResCB1 , NResCB2 , NResCB3 , NResCB4 , ResCodeBook1 , ResCodeBook2 , ResCodeBook3 , ResCodeBook4 , NResResCB1 , NResResCB2 , ResResCodeBook1 , ResResCodeBook2 , Compress , Image , CodeBook1 , Result , MSE , SNR , Entropy , RateAr )
int *PrintSNR ;
int *SmallHeader ;
int *BitMapCode ;
int *RateDist ;
int *NCB1 , *NCB2 , *NCB3 , *NCB4 ;
Fimage CodeBook2 , CodeBook3 , CodeBook4 ;
int *NResCB1 , *NResCB2 , *NResCB3 , *NResCB4 ;
Fimage ResCodeBook1 , ResCodeBook2 , ResCodeBook3 , ResCodeBook4 ;
int *NResResCB1 , *NResResCB2 ;
Fimage ResResCodeBook1 , ResResCodeBook2 ;
Cimage Compress ;
Fimage Image ;
Fimage CodeBook1 ;
Fimage Result ;
double *MSE ;
double *SNR ;
double *Entropy ;
double *RateAr ;
This module compresses a graylevel image (fimage) using a vector quantization algorithm. fvq supports both classified and multistaged/residual vector quantization (see [GG92]).
The classification is based on the energy of the coefficients vectors. The codebooks for the first class (vectors with the highest energy) are contained in the CodeBook1 file. The codebooks for the second and third classes (the energy of vectors dereases with the index class) are contained respectiveley in the CodeBook2 and CodeBook3 files. The values of energy thresholds which separate the different classes are read in the codebook files.
ResCodeBook1, ResCodeBook2 and ResCodeBook3 contain codebooks for the quantization of the residual vectors coming from the quantization with CodeBook1, CodeBook2 and CodeBook3 respectively (second stage quantization). ResResCodeBook1 and ResResCodeBook2 contain codebooks for the quantization of the residual vectors coming from the quantization with ResCodeBook1 and ResCodeBook2 respectively (third stage quantization).
Compress is the output compressed file. Notice that all lists of quantization symbols are arithmetically encoded using the arithm_encode2 module (see the documentation of this module for further details).
QImage is the quantized image, which can be reconstructed from Compress.
The -h option indicates that only a reduced header (not including the dimensions of image) should be inserted at the beginning of the Compress file.
When one performs classified vector quantization, one has to encode in addition the index of the class of each quantized vector in order to know which codebook was used to quantize it. This list of indices can be considered as a bitmap. When the codebooks used to quantize each class have size one, then the vectors are quantized to 0. In this case, it is normally useless to encode the bitmap of indices. The -M option specifies to encode this bitmap anyway (this option is used by fwvq module). Notice that this bitmap is also arithmetically encoded.
The -m option enables to compute a discrete rate-distortion curve. It only makes sense when the different codebook files contain more than one codebook.
The -n, -X, -Y and -Z options specify which codebook should be used in CodeBook1, CodeBook2, CodeBook3 and CodeBook4 respectively to perform the quantization. This supposes that these files contain more than one codebook and that the -m option is not selected.
Likewise, the -A, -B, -C, -D, -E and -F options specify which codebook should be used in ResCodeBook1, ResCodeBook2, ResCodeBook3, ResCodeBook4, ResResCodeBook1 and ResResCodeBook2 respectively to perform the quantization.
Last Modification date : Thu Nov 29 20:23:57 2001