How to solve "index exceeds matrix dimension" while using imread
Show older comments
I am trying to program the Wiener Filter. And the sizes of pictures that I am going to read range from 5MB to around 15MB. When I imread the picture, there is error saying "Index exceed the matrix dimension"
Error:
Index exceeds matrix dimensions.
Error in QM (line 3)
im=imread([base,files(1).name]);
Program:
base='Users\aa\Downloads\';
files = dir( fullfile(base,'1.tif') );
im=imread([base,files(1).name]);
I = im2double(im);
imshow(I);
title('Original Image (courtesy of MIT)');
LEN = 21;
THETA = 11;
PSF = fspecial('motion', LEN, THETA);
blurred = imfilter(I, PSF, 'conv', 'circular');
figure, imshow(blurred)
noise_mean = 0;
noise_var = 0.0001;
blurred_noisy = imnoise(blurred, 'gaussian', ...
noise_mean, noise_var);
figure, imshow(blurred_noisy)
title('Simulate Blur and Noise')
estimated_nsr = 0;
wnr2 = deconvwnr(blurred_noisy, PSF, estimated_nsr);
figure, imshow(wnr2)
title('Restoration of Blurred, Noisy Image Using NSR = 0')
estimated_nsr = noise_var / var(I(:));
wnr3 = deconvwnr(blurred_noisy, PSF, estimated_nsr);
figure, imshow(wnr3)
title('Restoration of Blurred, Noisy Image Using Estimated NSR');
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing 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!