How can I use the imgaussfilt() function to process several images i have already saved into an array in the workspace?

4 次查看(过去 30 天)
Here is the code I have so far...
clear
imagelist = dir('*.png');
N = numel(imagelist);
imdata = cell(1, numel(imagelist));
for k = 1: N
imdata{k} = imread(imagelist(k).name);
end
for i = 1:N
noiseless{i} = imgaussfilt(imdata(i))
end
This code succesfully saves the seven png images in an array and its possible, using imshow(imdata{7}) to display any image saved. Now i am trying to create a new array using the gaussfilt() function to reduce the noise level in each of the seven images. The error that I'm getting is
>> noiseforstack
Undefined function 'imgaussfilt' for input arguments of type 'cell'.
Error in noiseforstack (line 11)
noiseless{i} = imgaussfilt(imdata(i))
Obviously I am not using the function correctly however I am not sure how to fix the problem. Any help would be greatly appreciated.
Thank you!

回答(1 个)

Matthew Eicholtz
Matthew Eicholtz 2016-9-27
It looks like you are sending a cell array to the imgaussfilt function instead of just a single image. Watch your indexing. Change
noiseless{i} = imgaussfilt(imdata(i))
to
noiseless{i} = imgaussfilt(imdata{i})

Community Treasure Hunt

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

Start Hunting!

Translated by