while running the following code i got an error as Subscript indices must either be real positive integers or logicals.

1 回表示 (過去 30 日間)
clc; clear; close all; imtool close all; workspace; fontSize = 16; grayImage = imread('C:\Users\user\Documents\MATLAB\f13.jpg'); % subplot(2, 3, 1); imshow(grayImage, []); comp_image = imnoise(uint8(grayImage),'gaussian',0,.1); %Compression using wavelet imshow(comp_image); % load mask; [cr,bpp] = wcompress('c',grayImage,'mask.wtc','spiht','maxloop',12) Xc = wcompress('u','mask.wtc'); delete('mask.wtc') D = abs(grayImage-Xc).^2; mse = sum(D(:))/numel(grayImage) psnr = 10*log10(255*255/mse) % Display the original and the compressed image colormap(pink(255)) subplot(1,2,1); image(grayImage); title('Original image'); axis square subplot(1,2,2); image(Xc); title('Compressed image'); axis square
  1 件のコメント
NANDITA SHARMA
NANDITA SHARMA 2020 年 11 月 20 日
Use imresize to make your input image as a square matrix. Then run the code. I hope the code will run successfully now. The 'spiht' works on square marix, may be for that reason you are getting the error.

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

回答 (2 件)

Muruganandham Subramanian
Muruganandham Subramanian 2013 年 6 月 3 日

David Sanchez
David Sanchez 2013 年 6 月 3 日
Try with a different compression method. You could avoid your error message using 'ezw' instead of 'spiht'. Give them a try.

カテゴリ

Help Center および File ExchangeDenoising and Compression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by