Using wcompress in Matlab

7 ビュー (過去 30 日間)
Rhania MacBain
Rhania MacBain 2020 年 1 月 21 日
コメント済み: Rhania MacBain 2020 年 1 月 24 日
I am trying to demonstrate image compression via the haar wavelet transform in Matlab with the following code:
Xc = wcompress('c', J, 'apples.wtc', 'haar')
And I am getting the message:
Undefined function or variable 'Encoded_wtbx_DEC'.
Error in wcompress (line 491)
fileSize = wtcmngr('save',typeSAVE,Sav_filename,method_COMP,Encoded_wtbx_DEC);
Does anyone know why this could be?

採用された回答

Walter Roberson
Walter Roberson 2020 年 1 月 24 日
'haar' is not one of the valid compression methods for wcompress()
The valid compression methods are divided in three categories.
  • Progressive Coefficients Significance Methods (PCSM): MATLAB NameCompression Method Name
  • 'ezw'Embedded Zerotree Wavelet'
  • 'spiht'Set Partitioning In Hierarchical Trees
  • 'stw'Spatial-orientation Tree Wavelet
  • 'wdr'Wavelet Difference Reduction
  • 'aswdr'Adaptively Scanned Wavelet Difference Reduction
  • 'spiht_3d'Set Partitioning In Hierarchical Trees 3D for truecolor images
For more details on these methods, see the references and especially Walker and also Said and Pearlman.
  • Coefficients Thresholding Methods (CTM-1): MATLAB NameCompression Method Name
  • 'lvl_mmc'Subband thresholding of coefficients and Huffman encoding
For more details on this method, see the Strang and Nguyen reference.
  • Coefficients Thresholding Methods (CTM-2): MATLAB NameCompression Method Name
  • 'gbl_mmc_f'Global thresholding of coefficients and fixed encoding
  • 'gbl_mmc_h'Global thresholding of coefficients and Huffman encoding
Notice the lack of a 'haar' option.

その他の回答 (1 件)

Dinesh Yadav
Dinesh Yadav 2020 年 1 月 24 日
Hi Rhania,
There could be one of multiple reasons for the above error.
  • The variable or function definition of "Encoded_wtbx_DEC" is not defined prior to the command where it is used.
  • If it is defined in some other file or folder, they must be added to path or appropriately import variables into your current file where you are using it.
  • Check for spelling error as names of varaibles/functions are case sensitive.
Hope it helps.
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 1 月 24 日
Encoded_wtbx_DEC is an internal variable to wcompress. It is assigned a value by each of the various cases of the switch method_COMP near line 425 of wcompress. However, in the situation where the user-provided compression method is not any of 'gbl_mmc_h','gbl_mmc_f', 'lvl_mmc', 'ezw','spiht','spiht_3d','wdr','aswdr','stw' then no value is assigned to the variable and the error message is generated when the code tries to use the variable.
The code could be better designed to catch invalid compression methods, but the primary trigger is that the user passed in an invalid compression method.
Rhania MacBain
Rhania MacBain 2020 年 1 月 24 日
Thank you so much for explaining that, I really apppreciate it!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCompression についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by