⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme2

📁 Vector Quantization压缩算法
💻
字号:
EXAMPLE:Three training images: man, couple, crowd which are 512X512 and 8bpp.One test image: lena which is also 512X512 and 8bpp.  We want todesign a tree-structured VQ of dimension 4 made from 2X2 blocks of theimages with average rate 5 bits per vector.  The data is stored as"unsigned char" data.  So check the tsvq.h file (see the first realline of file) and make sure that DATATYPE is defined as:#define DATATYPE	unsigned charNote: If you are using 16bpp then define data as short int, etc.Then if needed, compile the programsmake allmake cleanPut all of the training images into one file:cp man training_datacat couple >> training_datacat crowd >> training_dataBlock the training data into vectors taken from 2X2 chunks of theimage using the "block" program from the stdvq directory.  Thetraining_data now has three images, so there are 3*512=1536 rows and512 columns:block -i training_data -r 1536 -l 512 -h 2 -w 2 -o training_data.TSThe output is a file called training_data.TS where TS is for trainingset.  Now the training data are ready to use.  Use the "tsvq" programto make a tree-structured codebook with rate 5 bits per vector.Recall that the vector dimension is 4.tsvq -t training_data.TS -c codebook -d 4 -r 5.0tsvq -t training_data.TS -c codebook -d 4 -r 5.0 -BThe first will output an unbalanced tree-structured codebook called"codebook" with average rate 5 bits per vector.  It will also output afile called "training_data.TS.stat" which contains the rate anddistortion and other information of the training data at each node ofthe codebook.  The information is needed for pruning.  The second willoutput a balanced tree-structured codebook called "codebook" withfixed rate 5 bits per vector.  It will also output a file called"training_data.TS.stat" which contains the rate and distortion and otherinformation of the training data at each node of the codebook.  Theinformation is needed for pruning.To encode the test image, the test image must first be arranged intovectors using the "block" program.  Then the "tsvqe" program is usedto encode the test image.  Finally, the "unblock" program from thestdvq directory is used to arrange the encoded/decoded vectors into adecoded image.  Note that the "tsvqe" program does both encoding anddecoding on the data and does not output the indices of the compressedvectors.block -i lena -r 512 -l 512 -h 2 -w 2 -o lena.TStsvqe -c codebook -i lena.TS -o lena.TS.encodedunblock -i lena.TS.encoded -r 512 -l 512 -h 2 -w 2 -o lena.final_________________________________________________________________________EXAMPLE:You could also use the "-R" option in "tsvqe" to output an imagecalled rate.dat which shows the instantaneous rate used at each pixelso you can see where more bits are being used throughout the image.tsvqe -c codebook -i lena.TS -o lena.TS.encoded -Runblock -i rate.dat -r 512 -l 512 -h 2 -w 2 -o rate.date.final_________________________________________________________________________EXAMPLE:Prune a tree-structured codebook with average rate 8 bits per vectorto yield a tree-structured codebook with average rate 5 bits pervector.First we create a large tree-structured codebook using "tsvq".  Notethat it doesn't matter if the tree is balanced or not. Use the"-s" option to name the output statistics file.tsvq -t training_data.TS -c codebook -d 4 -r 8.0 -s statstsvq -t training_data.TS -c codebook -d 4 -r 8.0 -s stats -BUse the "prune" program to produce a list of all optimal sub-trees.The "-E" option can be used to do entropy-constrained pruning ifdesired.prune -c codebook -s stats -o nested > list_of_subtreesprune -c codebook -s stats -o nested -E > list_of_subtreesThe file "list_of_subtrees" is a text file which lists all ofthe subtrees by number with their rates (or entropies) and distortions.The file "nested" contains the nested subtree structure.Look through the "list_of_subtrees" file to find the subtree withthe desired rate(entropy) - distortion.  Use the "select"program to choose the subtree:select -c codebook -s nested -n # -o codebook.#where # is the number of the subtree selected in the "list_of_subtrees."Then you are ready to encode a test image:block -i lena -r 512 -l 512 -h 2 -w 2 -o lena.TStsvqe -c codebook.# -i lena.TS -o lena.TS.encodedunblock -i lena.TS.encoded -r 512 -l 512 -h 2 -w 2 -o lena.final______________________________________________________________________EXAMPLE:Note that another way to generate a "stats" file is to encode adifferent set of training data using "tsvqe" with the "-D"tsvqe -c codebook -i training_data2.TS -o junk -Drm junkThis will output a file called training_set2.TS.stat for the codebookwhich can then be used in the "prune" program.prune -c codebook -s training_set2.TS.stat -o nested > list_of_subtrees

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -