wcompress

1 view (last 30 days)
warinthorn Kiadti
warinthorn Kiadti on 26 Apr 2012
Hi everybody, can someone please help me with this error, below is my code....
The CR_testImage.tif is unit8 59x64x3
X = imread('CR_testImage.tif');
[CR,BPP] = wcompress('c',X,'w_test.wtc','spiht','maxloop',12);
Xc = wcompress('u','w_test.wtc');
subplot(1,2,1); image(X);
axis square;
title('Original Image')
subplot(1,2,2); image(Xc);
axis square;
title('Compressed Image - 12 steps - bior4.4')
delete('w_test.wtc')
*When I run this code the message show..
??? Subscript indices must either be real positive integers or logicals.
Error in ==> wtc_spiht>wtc_spiht_dec at 524
Signific_MAT(idx_CHILD+d_PIX_Plan) = ...
Error in ==> wtc_spiht at 23
case 2 , [varargout{1:nbout}] = wtc_spiht_dec(varargin{:});
Error in ==> wtcmngr at 98
[varargout{1:nbout}] = funHDL('dec',WTC_Struct,stepFLAG);
Error in ==> wcompress at 452
X_decoded = wtcmngr('read',inputFile,stepFLAG);
Error in ==> Test_wc6 at 11
Xc = wcompress('u','w_test.wtc');
Thank you in advance..
Warin

Accepted Answer

Wayne King
Wayne King on 26 Apr 2012
You need to extend the one dimension of your image to the next power of 2 - 64x64x3, you can pad with zeros, see wextend() for help, then the above will work.
For example:
X = randi([0 255],64,64,3,'uint8');
  1 Comment
warinthorn Kiadti
warinthorn Kiadti on 26 Apr 2012
Thank you very much Wayne..
Do I have to extend the dimension of every input image to be power of 2? or Just this case...

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!