fwlbg_adap Generates training set(s) (starting from image(s)) and constructs a codebook sequence for wavelet transform vector quantization using LBG algorithm
fwlbg_adap [-r NLevel] [-q Level] [-o Orient] [-e EdgeIR] [-b ImpulseResponse2] [-n FilterNorm] [-d StopDecimLevel] [-w VectorWidth] [-h VectorHeight] [-M] [-l] [-s Sizec1] [-t Size2] [-u Size3] [-S ThresVal1] [-T ThresVal2] [-U ThresVal3] [-O OldCodeBook] [-X OldAdapCodeBook1] [-Y OldAdapCodeBook2] [-x AdapCodeBook2] [-y AdapCodeBook3] [-A TrainImage2] [-B TrainImage3] [-C TrainImage4] [-Q ResCodeBook] [-R ResResCodeBook] TrainImage1 ImpulseResponse CodeBook1
-r NLevel : Quantization is performed on MaxLevel scales
-q Level : Create codebook(s) at scale Level
-o Orient : Create codebook(s) for orientation Orient
-e EdgeIR : Impulse reponses of edge and preconditionning filters for orthogonal transform (fimage)
-b ImpulseResponse2 : Impulse response of filter 2 for biorthogonal transform (fsignal)
-n FilterNorm : Normalization mode for filter bank
-d StopDecimLevel : Level for decimation stop (default : 2)
-w VectorWidth : Width of vectors (default : 2)
-h VectorHeight : Height of vectors (default : 2)
-M : Generate codebooks of size equal to a power of two
-l : Take overlapping vectors in training images
-s Sizec1 : Size of output codebook for first class
-t Size2 : Size of output codebook for second class
-u Size3 : Size of output codebook for third class
-S ThresVal1 : First threshold value for classified VQ
-T ThresVal2 : Second threshold value for classified VQ
-U ThresVal3 : Third threshold value for classified VQ
-O OldCodeBook : Modify the first class codebook sequence (fimage)
-X OldAdapCodeBook1 : Modify the second class codebook sequence (fimage)
-Y OldAdapCodeBook2 : Modify the third class codebook sequence (fimage)
-x AdapCodeBook2 : Sequence of second class codebooks (fimage)
-y AdapCodeBook3 : Sequence of third class codebooks (fimage)
-A TrainImage2 : Training image (fimage)
-B TrainImage3 : Training image (fimage)
-C TrainImage4 : Training image (fimage)
-Q ResCodeBook : Generate codebook(s) for residu of quantization with ResCodeBook (fimage)
-R ResResCodeBook : Generate codebook(s) for residu of quantization with ResCodeBook and ResResCodeBook (fimage)
TrainImage1 : Training image (fimage)
ImpulseResponse : Impulse response of inner filters (fsignal)
CodeBook1 : Sequence of first class codebooks (fimage)
void fwlbg_adap (NumRecMax , Level , Orient , Edge_Ri , Ri2 , FilterNorm , StopDecim , Width , Height , MultiCB , Lap , Sizec1 , Sizec2 , Sizec3 , ThresVal1 , ThresVal2 , ThresVal3 , OldCodeBook , OldAdapCodeBook2 , OldAdapCodeBook3 , Output2 , Output3 , Image2 , Image3 , Image4 , ResCodeBook , ResResCodeBook , Image1 , Ri , Output1 )
int *NumRecMax ;
int *Level ;
int *Orient ;
Fimage Edge_Ri ;
Fsignal Ri2 ;
int *FilterNorm ;
int *StopDecim ;
int *Width ;
int *Height ;
int *MultiCB ;
int *Lap ;
int *Sizec1 , *Sizec2 , *Sizec3 ;
float *ThresVal1 , *ThresVal2 , *ThresVal3 ;
Fimage OldCodeBook ;
Fimage OldAdapCodeBook2 , OldAdapCodeBook3 ;
Fimage Output2 , Output3 ;
Fimage Image2 , Image3 , Image4 ;
Fimage ResCodeBook , ResResCodeBook ;
Fimage Image1 ;
Fsignal Ri ;
Fimage Output1 ;
This module generates sets of codebooks for the quantization of image wavelet transforms. It is based on the LBG algorithm, and it operates on training sets of wavelet coefficients vectors. It can generate codebooks for both classified and multi-staged or residual vector quantization. The classification is based on the energy of the coefficients vectors.
The training sets of wavelet coefficients vectors are build using the wavelet transforms of the images TrainImage1, TrainImage2, TrainImage3 and TrainImage4. These images are thus wavelet transformed in the same way as in fwvq program (see fwvq program documentation for the signification of the -r, -e, -b and -n options, as well as of ImpulseResponse). The only difference here is that there is a possiblity of stopping the decimation in the subband decomposition using the -d option. StopDecimLevel is a positive integer. From this level on, the decimation is not performed (See dyowave2 and dywave2 modules documentation for further details). This enables to obtain larger training sets. Notice that one training set is generated separately for each subimage of the wavelet transform.
The -q option specifies that only the codebooks at scale Level should be generated (Level is a positive integer).
The -o option specifies that only the codebooks in orientation Orient should be generated (Orient is an integer ranging from 0 to 3). Here Orient is 0 for average, 1 for horizontal details, 2 for vertical details, and 3 for diagonal details. Notice that if the option -o is not selected, then the average subimage is generated only at level MaxLevel.
The -h and -w options specify the height and width of vectors. Here the codebooks for higher levels are generated first. When going to a lower scale, VectorWidth and VectorHeight are multipied by 2, unless they are bigger than 2, or the size of the subimage is less than 128×128 (This is done because the size of the vectors must be negligible compared to the subimage size).
If the -l option is selected, then overlapping vectors are taken in the wavelet transform. This enables to get larger training sets.
CodeBook1, AdapCodeBook2 and AdapCodeBook3 contain the sets of generated codebooks for the first, second and third classes respectively.
If the -M option is selected, then codebooks for each power of two is generated, with size ranging from 1 to Size1, Size2 or Size3 (respectively for CodeBook1, AdapCodeBook2 and AdapCodeBook3). If it is not selected then only one codebook of size Size1, Size2 or Size3 is generated.
The energy threshold for the different classes are selected using the -S, -T and -U options. These thresholds are equal to the variance of the training set multiplied by ThresVal1, ThresVal2 or ThresVal3 (these are positive floating point numbers). Typically, one should choose these values between 0.5 and 3.0.
The -Q and -R options enable to generate codebooks adapted to multistaged vector quantization. If for example the -Q option is selected then the input set of codebooks in ResCodeBook is used to quantize the training set, and the residual errors of this quantization are used to form a new codebook. The process can be iterated with the -R option. Notice that these options should not be used in conjonction with the -x and -y options.
The -O, -X, -Y options enable to modify existing codebook(s). This can be used in conjonction with the -q and -o options. It can be used for example to generate the codebooks for the different subimages separately, in order to get customized sizes of codebooks and vectors.
Notice that the representation format for the codebooks sequence is not the same as for wlbg_adap module : here all the codebooks are grouped in a single fimage, whereas for wlbg_adap, they were distributed in the wavelet transform format wtrans2d.
Notice also that the running time may be very long if large codebooks with large dimension vectors are generated. It may takes several hours (if not days) to generate a full set of codebook sequences with 4×4 vectors at level 1 and 2, for 512×512 images, starting from three or four images for the training set.
dybiowave2, dyowave2, wlbg_adap.
Last Modification date : Thu Nov 29 20:23:57 2001