next up previous contents index
Next: Cfwivq Up: Reference Previous: mk_codebook   Contents   Index

mk_trainset

$ \bigcirc$Name


mk_trainset Generates a training set of rectangular blocks from images




$ \bigcirc$Command Synopsis


mk_trainset [-w VectorWidth] [-h VectorHeight] [-l] [-d Decim] [-e Edge] [-t ThresVal1] [-u ThresVal2] [-v ThresVal3] [-f SizeCB] [-a Image2] [-b Image3] [-c Image4] [-A Image5] [-B Image6] [-C Image7] [-D Image8] [-m TrainingSet2] [-n TrainingSet3] [-o TrainingSet4] Image TrainingSet



-w VectorWidth : Width of blocks (default : 2)

-h VectorHeight : Height of blocks (default : 2)

-l : Take overlapping blocks in training images

-d Decim : Decimation factor in training images (for wavelet transforms, default : 1)

-e Edge : Do not take overlapping vectors if the distance to an edge is smaller than Edge (default : 0)

-t ThresVal1 : First threshold value for classified VQ

-u ThresVal2 : Second threshold value for classified VQ

-v ThresVal3 : Third threshold value for classified VQ

-f SizeCB : Size of Codebook

-a Image2 : Training image (fimage)

-b Image3 : Training image (fimage)

-c Image4 : Training image (fimage)

-A Image5 : Training image (fimage)

-B Image6 : Training image (fimage)

-C Image7 : Training image (fimage)

-D Image8 : Training image (fimage)

-m TrainingSet2 : Resulting training set for second class (fimage)

-n TrainingSet3 : Resulting training set for third class (fimage)

-o TrainingSet4 : Resulting training set for fourth class (fimage)

Image : Training image (fimage)

TrainingSet : Resulting training set for first class (fimage)




$ \bigcirc$Function Summary


void mk_trainset (Width , Height , Lap , Decim , Edge , ThresVal1 , ThresVal2 , ThresVal3 , SizeCB , Image2 , Image3 , Image4 , Image5 , Image6 , Image7 , Image8 , Result2 , Result3 , Result4 , Image , Result )

int *Width , *Height ;

int *Lap ;

int *Decim ;

int *Edge ;

float *ThresVal1 , *ThresVal2 , *ThresVal3 ;

int *SizeCB ;

Fimage Image2 , Image3 , Image4 , Image5 , Image6 , Image7 , Image8 ;

Fimage Result2 , Result3 , Result4 ;

Fimage Image ;

Fimage Result ;




$ \bigcirc$Description


This module generates one or several training sets of rectangular blocks of pixels which are extracted from one or several floating point images. The input images are read in Image, Image2, ..., Image8 files. The resulting training set(s) is (are) stored in TrainingSet, (TrainingSet2, ..., TrainingSet2) file(s).

The -w and -h options can be used to set the width and height of rectangular blocks extracted from the image(s). VectorWidth and VectorHeight are strictly positive integers.

Figure 1: On the left : blocks extracted from image are not overlapping. On the right : blocks extracted from image are overlapping.

When the -l option is not set, extracted blocks are not overlapping (as in the left part of figure 1). On the contrary, when this option is selected, extracted blocks are overlapping (as in the right part of figure 1). This option thus enables to extract a larger number of vectors from a single image (this number is multiplied roughly by VectorWidth × VectorHeight).

Figure 2: Blocks are not constructed with contiguous pixels. Here Decim = 2.

The -d option enables to construct vectors with non contiguous pixels. Namely, the vertical and horizontal distance between the pixels is Decim (See figure 2). Decim is a strictly positive number. When equal to 1 (default value), vectors are constructed with contiguous pixels. This option is especially useful when the input images are sub-images of wavelet transforms generated with dywave2 and dyowave2.

The -e option is effective only when the -l option has also been selected. It indicates that extracted blocks should not be overlapping if they are located at a distance less than Edge from the edges of the image. Edge is a positive integer. This option is especially useful when the input images are sub-images of wavelet transforms which has been computed with special edge processing methods (like the one in owave2 module).

The -t, -u and -v options enable to sort the extracted blocks according to their energy and put them in different training sets according to their energy value. The energy of a K-dimensional vector X = {Xk}1 $\scriptstyle \leq$ k $\scriptstyle \leq$ K is simply defined by

E(X) = $\displaystyle {\frac{{1}}{{K}}}$$\displaystyle \sum_{{k=1}}^{K}$| Xk|2.

Given a set of thresholds T1 >...> TS > 0 (with S $ \leq$ 3), the blocks extracted from the image(s) are sorted by finding the index s such that

Ts-1 > E(X) $\displaystyle \geq$ Ts

(with T0 = + $ \infty$ and TS+1 = 0). One thus obtains S + 1 (sub-) training sets which are stored respectively in the files TrainingSet, TrainingSet2, ... The thresholds T1,... depend on the mean energy Em of all the extracted vectors and on the input values ThresVal1, ThresVal2, and ThresVal3 :
T1   = ThresVal1*Em              if the -t option is selected  
T2   = ThresVal2*Em              if the -u option is selected  
T3   = ThresVal3*Em              if the -v option is selected  

These options are especially useful when one wants to make training sets for the creation of codebooks for classified vector quantization (see flbg_adap and fvq modules. ThresVal1, ThresVal2, and ThresVal3 are floating point values. They should range between 0.5 and 5.0 in order to get reasonable sizes of training sets. If it happens that T1 is too large so that the first training set is empty, then the module automatically decreases the value of ThresVal1 so that the first training set becomes non empty. The same is done with T2 and T3. Notice that if for example the -t option is selected while neither the -m, -n and -o options are selected, then the mk_trainset module will only put in TrainingSet file all the extracted blocks whose energy is larger then ThresVal1*Em.

The -f option enables to ensure that the size of the resulting training sets are big enough when compared to the size of the codebooks which will be created based on these training sets (see flbg and flbg_adap modules). SizeCB is a positive integer. If the -f option is selected, then the module will try ensure that the size of all the generated training sets is larger than 10×SizeCB (of course this is not possible if for example the total number of extracted blocks is less that 10×SizeCB).




$ \bigcirc$See Also


flbg_adap, flbg.


$ \bigcirc$Version 1.00


Last Modification date : Thu Nov 29 20:23:57 2001


$ \bigcirc$Author


Jean-Pierre D'Ales






next up previous contents index
Next: Cfwivq Up: Reference Previous: mk_codebook   Contents   Index
mw 2004-05-05